def verify_configs(step): step("\n########## Verifying all configurations.. ##########\n") for i in range(0, len(bgp_configs)): bgp_cfg = bgp_configs[i] switch = switches[i] for cfg in bgp_cfg: res = SwitchVtyshUtils.verify_cfg_exist(switch, [cfg]) assert res, "Config \"%s\" was not correctly configured!" % cfg
def verify_no_ip_community(step): step("\n########## Verifying no ip prefix-list ##########\n") switch = switches[0] cmd = "no ip community-list BGP_IN" step("### Unconfiguring ip community-list BGP_IN ###\n") SwitchVtyshUtils.vtysh_cfg_cmd(switch, [cmd]) cfg = "ip community-list BGP_IN permit 2:0" step("### Checking ip community-list config ###\n") exists = SwitchVtyshUtils.verify_cfg_exist(switch, []) assert not exists, "Config \"%s\" was not removed" % cfg cfg = "ip community-list BGP_IN permit 3:0" step("### Checking ip community-list config ###\n") exists = SwitchVtyshUtils.verify_cfg_exist(switch, []) assert not exists, "Config \"%s\" was not removed" % cfg step("### ip community-list configs were successfully removed ###\n")
def verify_bgp_configs(step): step("\n########## Verifying all configurations.. ##########\n") i = 0 for switch in switches: bgp_cfg_array = all_cfg_array[i] for cfg in bgp_cfg_array: res = SwitchVtyshUtils.verify_cfg_exist(switch, [cfg]) assert res, "Config \"%s\" was not correctly configured!" % cfg i += 1 step("### All configurations were verified successfully ###\n")
def verify_no_peer_group(step): step("\n########### Verifying no peer-group ##########\n") step("### Removing peer-group ###\n") switch = switches[0] cfg_array = [] cfg_array.append("router bgp %s" % bgp1_asn) peer_group_cfg = "neighbor %s" % bgp_peer_group cfg_array.append("no %s" % peer_group_cfg) SwitchVtyshUtils.vtysh_cfg_cmd(switch, cfg_array) step("### Verifying peer-group config removed ###\n") exists = SwitchVtyshUtils.verify_cfg_exist(switch, [peer_group_cfg]) assert not exists, "Peer-group was not unconfigured" step("### Peer-group unconfigured successfully ###\n")