def setup_vrf_attr_src_mac(self, duthosts, rand_one_dut_hostname, ptfhost, dut_facts): duthost = duthosts[rand_one_dut_hostname] # -------- Setup ---------- extra_vars = {'router_mac': self.new_vrf1_router_mac} duthost.host.options['variable_manager'].extra_vars.update(extra_vars) duthost.template(src="vrf/vrf_attr_src_mac.j2", dest="/tmp/vrf_attr_src_mac.json") duthost.shell("config load -y /tmp/vrf_attr_src_mac.json") gen_vrf_neigh_file('Vrf1', ptfhost, render_file="/tmp/vrf1_neigh.txt") gen_vrf_neigh_file('Vrf2', ptfhost, render_file="/tmp/vrf2_neigh.txt") # -------- Testing ---------- yield # -------- Teardown ---------- extra_vars = {'router_mac': dut_facts['router_mac']} duthost.host.options['variable_manager'].extra_vars.update(extra_vars) duthost.template(src="vrf/vrf_attr_src_mac.j2", dest="/tmp/vrf_attr_src_mac.json") duthost.shell("config load -y /tmp/vrf_attr_src_mac.json")
def setup_vrf_attr_src_mac(self, duthost, ptfhost, host_facts): # -------- Setup ---------- extra_vars = {'router_mac': self.new_vrf1_router_mac} duthost.host.options['variable_manager'].extra_vars.update(extra_vars) duthost.template(src="vrf_attr_src_mac.j2", dest="/tmp/vrf_attr_src_mac.json") duthost.shell("config load -y /tmp/vrf_attr_src_mac.json") gen_vrf_neigh_file('Vrf1', ptfhost, render_file="/tmp/vrf1_neigh.txt") gen_vrf_neigh_file('Vrf2', ptfhost, render_file="/tmp/vrf2_neigh.txt") # -------- Testing ---------- yield # -------- Teardown ---------- extra_vars = { 'router_mac': host_facts['ansible_Ethernet0']['macaddress'] } duthost.host.options['variable_manager'].extra_vars.update(extra_vars) duthost.template(src="vrf_attr_src_mac.j2", dest="/tmp/vrf_attr_src_mac.json") duthost.shell("config load -y /tmp/vrf_attr_src_mac.json")
def setup_vrf_attr_ttl(self, duthost, ptfhost): # -------- Setup ---------- duthost.copy(src="vrf/vrf_attr_ttl_action.json", dest="/tmp") duthost.copy(src="vrf/vrf_restore.json", dest="/tmp") duthost.shell("config load -y /tmp/vrf_attr_ttl_action.json") gen_vrf_neigh_file('Vrf1', ptfhost, render_file="/tmp/vrf1_neigh.txt") gen_vrf_neigh_file('Vrf2', ptfhost, render_file="/tmp/vrf2_neigh.txt") # -------- Testing ---------- yield # -------- Teardown ---------- duthost.shell("config load -y /tmp/vrf_restore.json")
def setup_vrf_attr_ip_state(self, duthosts, rand_one_dut_hostname, ptfhost): duthost = duthosts[rand_one_dut_hostname] # -------- Setup ---------- duthost.copy(src="vrf/vrf_attr_ip_state.json", dest="/tmp") duthost.copy(src="vrf/vrf_restore.json", dest="/tmp") duthost.shell("config load -y /tmp/vrf_attr_ip_state.json") gen_vrf_neigh_file('Vrf1', ptfhost, render_file="/tmp/vrf1_neigh.txt") gen_vrf_neigh_file('Vrf2', ptfhost, render_file="/tmp/vrf2_neigh.txt") # -------- Testing ---------- yield # -------- Teardown ---------- duthost.shell("config load -y /tmp/vrf_restore.json")