Skip to content

Commit

Permalink
Reduce code duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
robertvolkmann committed Jul 22, 2024
1 parent 53e6316 commit c0087b4
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -242,24 +242,18 @@ endef

.PHONY: ssh-firewall
ssh-firewall:
$(eval firewall = $(shell ssh -F files/ssh/config leaf01 "vtysh -c 'show bgp neighbors firewall json' | \
python3 -c 'import sys, json; data = json.load(sys.stdin); key = next(iter(data)); print(data[key][\"bgpNeighborAddr\"] + \"%\" + key)'" \
))
ssh -F files/ssh/config $(firewall) $(COMMAND)
$(eval address = $(call get-ipv6-link-local-address,firewall))
ssh -F files/ssh/config $(address) $(COMMAND)

.PHONY: ssh-machine01
ssh-machine01:
$(eval machine = $(shell ssh -F files/ssh/config leaf01 "vtysh -c 'show bgp vrf $(VRF) neighbors machine01 json' | \
python3 -c 'import sys, json; data = json.load(sys.stdin); key = next(iter(data)); print(data[key][\"bgpNeighborAddr\"] + \"%\" + key)'" \
))
ssh -F files/ssh/config $(machine) $(COMMAND)
$(eval address = $(call get-ipv6-link-local-address,machine01,$(VRF)))
ssh -F files/ssh/config $(address) $(COMMAND)

.PHONY: ssh-machine02
ssh-machine02:
$(eval machine = $(shell ssh -F files/ssh/config leaf01 "vtysh -c 'show bgp vrf $(VRF) neighbors machine02 json' | \
python3 -c 'import sys, json; data = json.load(sys.stdin); key = next(iter(data)); print(data[key][\"bgpNeighborAddr\"] + \"%\" + key)'" \
))
ssh -F files/ssh/config $(machine) $(COMMAND)
$(eval address = $(call get-ipv6-link-local-address,machine02,$(VRF)))
ssh -F files/ssh/config $(address) $(COMMAND)

.PHONY: connect-to-cloudflare
connect-to-cloudflare:
Expand Down

0 comments on commit c0087b4

Please sign in to comment.