def test_one_port_many_acl_tables(self, dvs, dvs_acl): # Create 4 ACL tables and bind them to Ethernet0 bind_ports = ["Ethernet0"] acl_tables = ["test1", "test2", "test3", "test4"] for acl_tbl in acl_tables: dvs_acl.create_acl_table(acl_tbl, "L3", bind_ports) dvs_acl.verify_acl_table_count(len(acl_tables)) dvs_acl.verify_acl_table_groups(len(bind_ports)) acl_table_ids = dvs_acl.get_acl_table_ids(len(acl_tables)) for acl_tbl_id in acl_table_ids: dvs_acl.verify_acl_table_port_binding(acl_tbl_id, bind_ports, len(acl_tables)) # Update bind list and verify bind_ports = [] for acl_tbl in acl_tables: dvs_acl.update_acl_table_port_list(acl_tbl, bind_ports) dvs_acl.verify_acl_table_groups(0) # Breakout Ethernet0 dpb = DPB() dpb.breakout(dvs, "Ethernet0", maxBreakout) # Breakin Ethernet0, 1, 2, 3 dpb.breakin(dvs, ["Ethernet0", "Ethernet1", "Ethernet2", "Ethernet3"]) for acl_tbl in acl_tables: dvs_acl.remove_acl_table(acl_tbl)
def test_many_ports_many_acl_tables(self, dvs): # Prepare ACL table names aclTableNames = [] for i in range(maxAclTables): aclTableNames.append("aclTable" + str(i+1)) # Prepare all port names portNames = [] for i in range(maxPorts): portNames.append("Ethernet" + str(i)) # Prepare root port names rootPortNames = [] for i in range(0, maxPorts, maxBreakout): rootPortNames.append("Ethernet" + str(i)) # Create ACL tables and bind root ports for aclTable in aclTableNames: self.dvs_acl.create_acl_table(aclTable, "L3", rootPortNames) self.dvs_acl.verify_acl_group_num(maxRootPorts) # Remove the dependency on all root ports by # unbinding them from all ACL tables. bind_ports = [] for aclTable in aclTableNames: self.dvs_acl.update_acl_table(aclTable, bind_ports) self.dvs_acl.verify_acl_group_num(0) # Breakout all root ports dpb = DPB() for pName in rootPortNames: #print "Breaking out %s"%pName dpb.breakout(dvs, pName, maxBreakout) # Add all ports to aclTable1 self.dvs_acl.update_acl_table(aclTableNames[0], portNames) self.dvs_acl.verify_acl_group_num(maxPorts) # Remove all ports from aclTable1 bind_ports = [] self.dvs_acl.update_acl_table(aclTableNames[0], bind_ports) self.dvs_acl.verify_acl_group_num(0) # Breakin all ports for i in range(0, maxPorts, maxBreakout): #print "Breaking in %s"%portNames[i:i+maxBreakout] dpb.breakin(dvs, portNames[i:i+maxBreakout]) for aclTable in aclTableNames: self.dvs_acl.remove_acl_table(aclTable) self.dvs_acl.verify_acl_table_count(0)
def test_one_acl_table_many_ports(self, dvs): # Create ACL table and bind it to Ethernet0 and Ethernet4 bind_ports = ["Ethernet0", "Ethernet4"] self.dvs_acl.create_acl_table("test", "L3", bind_ports) self.dvs_acl.verify_acl_table_count(1) self.dvs_acl.verify_acl_group_num(2) acl_table_ids = self.dvs_acl.get_acl_table_ids() self.dvs_acl.verify_acl_table_ports_binding(bind_ports, acl_table_ids[0]) # Update bind list and verify bind_ports = ["Ethernet4"] self.dvs_acl.update_acl_table("test", bind_ports) self.dvs_acl.verify_acl_group_num(1) acl_table_ids = self.dvs_acl.get_acl_table_ids() self.dvs_acl.verify_acl_table_ports_binding(bind_ports, acl_table_ids[0]) # Breakout Ethernet0 dpb = DPB() dpb.breakout(dvs, "Ethernet0", maxBreakout) time.sleep(2) #Update bind list and verify bind_ports = ["Ethernet0", "Ethernet1", "Ethernet2", "Ethernet3","Ethernet4"] self.dvs_acl.update_acl_table("test", bind_ports) self.dvs_acl.verify_acl_group_num(5) self.dvs_acl.verify_acl_table_ports_binding(bind_ports, acl_table_ids[0]) # Update bind list and verify bind_ports = ["Ethernet4"] self.dvs_acl.update_acl_table("test", bind_ports) self.dvs_acl.verify_acl_group_num(1) self.dvs_acl.verify_acl_table_ports_binding(bind_ports, acl_table_ids[0]) #Breakin Ethernet0, 1, 2, 3 dpb.breakin(dvs, ["Ethernet0", "Ethernet1", "Ethernet2", "Ethernet3"]) time.sleep(2) # Update bind list and verify bind_ports = ["Ethernet0", "Ethernet4"] self.dvs_acl.update_acl_table("test", bind_ports) self.dvs_acl.verify_acl_group_num(2) self.dvs_acl.verify_acl_table_ports_binding(bind_ports, acl_table_ids[0]) #Delete ACL table self.dvs_acl.remove_acl_table("test") self.dvs_acl.verify_acl_group_num(0)
def test_one_acl_table_many_ports(self, dvs, dvs_acl): # Create ACL table and bind it to Ethernet0 and Ethernet4 bind_ports = ["Ethernet0", "Ethernet4"] dvs_acl.create_acl_table("test", "L3", bind_ports) dvs_acl.verify_acl_table_count(1) dvs_acl.verify_acl_table_groups(2) acl_table_ids = dvs_acl.get_acl_table_ids(1) dvs_acl.verify_acl_table_port_binding(acl_table_ids[0], bind_ports, 1) # Update bind list and verify bind_ports = ["Ethernet4"] dvs_acl.update_acl_table_port_list("test", bind_ports) dvs_acl.verify_acl_table_groups(1) acl_table_ids = dvs_acl.get_acl_table_ids(1) dvs_acl.verify_acl_table_port_binding(acl_table_ids[0], bind_ports, 1) # Breakout Ethernet0 dpb = DPB() dpb.breakout(dvs, "Ethernet0", maxBreakout) # Update bind list and verify bind_ports = ["Ethernet0", "Ethernet1", "Ethernet2", "Ethernet3", "Ethernet4"] dvs_acl.update_acl_table_port_list("test", bind_ports) dvs_acl.verify_acl_table_groups(5) dvs_acl.verify_acl_table_port_binding(acl_table_ids[0], bind_ports, 1) # Update bind list and verify bind_ports = ["Ethernet4"] dvs_acl.update_acl_table_port_list("test", bind_ports) dvs_acl.verify_acl_table_groups(1) dvs_acl.verify_acl_table_port_binding(acl_table_ids[0], bind_ports, 1) # Breakin Ethernet0, 1, 2, 3 dpb.breakin(dvs, ["Ethernet0", "Ethernet1", "Ethernet2", "Ethernet3"]) # Update bind list and verify bind_ports = ["Ethernet0", "Ethernet4"] dvs_acl.update_acl_table_port_list("test", bind_ports) dvs_acl.verify_acl_table_groups(2) dvs_acl.verify_acl_table_port_binding(acl_table_ids[0], bind_ports, 1) # Delete ACL table dvs_acl.remove_acl_table("test") dvs_acl.verify_acl_table_groups(0)
def test_port_breakout_all(self, dvs): dpb = DPB() port_names = [] for i in range(maxRootPorts): pname = "Ethernet" + str(i*maxBreakOut) port_names.append(pname) for pname in port_names: dpb.breakout(dvs, pname, maxBreakOut) child_port_names = [] for i in range(maxPorts): cpname = "Ethernet" + str(i) child_port_names.append(cpname) for i in range(32): start = i*maxBreakOut end = start+maxBreakOut dpb.breakin(dvs, child_port_names[start:end])
def test_port_breakout_multiple(self, dvs): dpb = DPB() port_names = ["Ethernet0", "Ethernet12", "Ethernet64", "Ethernet112"] for pname in port_names: dpb.breakout(dvs, pname, maxBreakOut) dpb.breakin(dvs, ["Ethernet0", "Ethernet1", "Ethernet2", "Ethernet3"]) dpb.breakin(dvs, ["Ethernet12", "Ethernet13", "Ethernet14", "Ethernet15"]) dpb.breakin(dvs, ["Ethernet64", "Ethernet65", "Ethernet66", "Ethernet67"]) dpb.breakin( dvs, ["Ethernet112", "Ethernet113", "Ethernet114", "Ethernet115"])
def test_port_breakout_all(self, dvs): dpb = DPB() port_names = [] for i in range(32): pname = "Ethernet" + str(i*4) port_names.append(pname) for pname in port_names: dpb.breakout(dvs, pname, 4) child_port_names = [] for i in range(128): cpname = "Ethernet" + str(i) child_port_names.append(cpname) for i in range(32): start = i*4 end = start+4 dpb.breakin(dvs, child_port_names[start:end])
def test_port_breakout_one(self, dvs): dpb = DPB() dpb.breakout(dvs, "Ethernet0", maxBreakOut) #print "**** 1X40G --> 4X10G passed ****" dpb.change_speed_and_verify(dvs, ["Ethernet0", "Ethernet1", "Ethernet2", "Ethernet3"], speed25G) #print "**** 4X10G --> 4X25G passed ****" dpb.change_speed_and_verify(dvs, ["Ethernet0", "Ethernet1", "Ethernet2", "Ethernet3"], speed10G) #print "**** 4X25G --> 4X10G passed ****" dpb.breakin(dvs, ["Ethernet0", "Ethernet1", "Ethernet2", "Ethernet3"]) #print "**** 4X10G --> 1X40G passed ****" dpb.change_speed_and_verify(dvs, ["Ethernet0"], speed100G) #print "**** 1X40G --> 1X100G passed ****" dpb.breakout(dvs, "Ethernet0", maxBreakOut) #print "**** 1X100G --> 4X25G passed ****" dpb.change_speed_and_verify(dvs, ["Ethernet0", "Ethernet1", "Ethernet2", "Ethernet3"], speed10G) #print "**** 4X25G --> 4X10G passed ****" dpb.change_speed_and_verify(dvs, ["Ethernet0", "Ethernet1", "Ethernet2", "Ethernet3"], speed25G) #print "**** 4X10G --> 4X25G passed ****" dpb.breakin(dvs, ["Ethernet0", "Ethernet1", "Ethernet2", "Ethernet3"]) #print "**** 4X25G --> 1X100G passed ****" dpb.breakout(dvs, "Ethernet0", maxBreakOut/2) #print "**** 1X100G --> 2X50G passed ****" dpb.breakin(dvs, ["Ethernet0", "Ethernet2"]) #print "**** 2X50G --> 1X100G passed ****" dpb.change_speed_and_verify(dvs, ["Ethernet0"], speed40G)
def test_port_breakout_one(self, dvs): dpb = DPB() dpb.breakout(dvs, "Ethernet0", 4) #print "**** 1X40G --> 4X10G passed ****" dpb.change_speed_and_verify(dvs, ["Ethernet0", "Ethernet1", "Ethernet2", "Ethernet3"], 25000) #print "**** 4X10G --> 4X25G passed ****" dpb.change_speed_and_verify(dvs, ["Ethernet0", "Ethernet1", "Ethernet2", "Ethernet3"], 10000) #print "**** 4X25G --> 4X10G passed ****" dpb.breakin(dvs, ["Ethernet0", "Ethernet1", "Ethernet2", "Ethernet3"]) #print "**** 4X10G --> 1X40G passed ****" dpb.change_speed_and_verify(dvs, ["Ethernet0"], 100000) #print "**** 1X40G --> 1X100G passed ****" dpb.breakout(dvs, "Ethernet0", 4) #print "**** 1X100G --> 4X25G passed ****" dpb.change_speed_and_verify(dvs, ["Ethernet0", "Ethernet1", "Ethernet2", "Ethernet3"], 10000) #print "**** 4X25G --> 4X10G passed ****" dpb.change_speed_and_verify(dvs, ["Ethernet0", "Ethernet1", "Ethernet2", "Ethernet3"], 25000) #print "**** 4X10G --> 4X25G passed ****" dpb.breakin(dvs, ["Ethernet0", "Ethernet1", "Ethernet2", "Ethernet3"]) #print "**** 4X25G --> 1X100G passed ****" dpb.breakout(dvs, "Ethernet0", 2) #print "**** 1X100G --> 2X50G passed ****" dpb.breakin(dvs, ["Ethernet0", "Ethernet2"]) #print "**** 2X50G --> 1X100G passed ****" dpb.change_speed_and_verify(dvs, ["Ethernet0"], 40000)
def test_one_acl_table_many_ports(self, dvs): dvs.setup_db() # Create ACL table and bind it to Ethernet0 and Ethernet4 bind_ports = ["Ethernet0", "Ethernet4"] dvs.create_acl_table("test", "L3", bind_ports) time.sleep(2) acl_table_ids = dvs.get_acl_table_ids() assert len(acl_table_ids) == 1 dvs.verify_acl_group_num(2) acl_group_ids = dvs.get_acl_group_ids() dvs.verify_acl_group_member(acl_group_ids[0], acl_table_ids[0]) dvs.verify_acl_group_member(acl_group_ids[1], acl_table_ids[0]) dvs.verify_acl_port_binding(bind_ports) # Update bind list and verify bind_ports = ["Ethernet4"] fvs = swsscommon.FieldValuePairs([("ports", ",".join(bind_ports))]) dvs.update_acl_table("test", fvs) time.sleep(2) dvs.verify_acl_group_num(1) acl_group_ids = dvs.get_acl_group_ids() dvs.verify_acl_group_member(acl_group_ids[0], acl_table_ids[0]) dvs.verify_acl_port_binding(bind_ports) # Breakout Ethernet0 dpb = DPB() dpb.breakout(dvs, "Ethernet0", 4) time.sleep(2) #Update bind list and verify bind_ports = ["Ethernet0", "Ethernet1", "Ethernet2", "Ethernet3","Ethernet4"] fvs = swsscommon.FieldValuePairs([("ports", ",".join(bind_ports))]) dvs.update_acl_table("test", fvs) time.sleep(2) dvs.verify_acl_group_num(5) acl_group_ids = dvs.get_acl_group_ids() dvs.verify_acl_group_member(acl_group_ids[0], acl_table_ids[0]) dvs.verify_acl_group_member(acl_group_ids[1], acl_table_ids[0]) dvs.verify_acl_group_member(acl_group_ids[2], acl_table_ids[0]) dvs.verify_acl_group_member(acl_group_ids[3], acl_table_ids[0]) dvs.verify_acl_group_member(acl_group_ids[4], acl_table_ids[0]) dvs.verify_acl_port_binding(bind_ports) time.sleep(2) # Update bind list and verify bind_ports = ["Ethernet4"] fvs = swsscommon.FieldValuePairs([("ports", ",".join(bind_ports))]) dvs.update_acl_table("test", fvs) dvs.verify_acl_group_num(1) acl_group_ids = dvs.get_acl_group_ids() dvs.verify_acl_group_member(acl_group_ids[0], acl_table_ids[0]) dvs.verify_acl_port_binding(bind_ports) #Breakin Ethernet0, 1, 2, 3 dpb.breakin(dvs, ["Ethernet0", "Ethernet1", "Ethernet2", "Ethernet3"]) time.sleep(2) # Update bind list and verify bind_ports = ["Ethernet0", "Ethernet4"] fvs = swsscommon.FieldValuePairs([("ports", ",".join(bind_ports))]) dvs.update_acl_table("test", fvs) time.sleep(2) dvs.verify_acl_group_num(2) acl_group_ids = dvs.get_acl_group_ids() dvs.verify_acl_group_member(acl_group_ids[0], acl_table_ids[0]) dvs.verify_acl_group_member(acl_group_ids[1], acl_table_ids[0]) dvs.verify_acl_port_binding(bind_ports) #Delete ACL table dvs.remove_acl_table("test") time.sleep(2) dvs.verify_acl_group_num(0)