コード例 #1
0
    def test_dependency(self, dvs):
        dvs.setup_db()
        lag = "0001"
        p = Port(dvs, "Ethernet0")
        p.sync_from_config_db()

        # 1. Create PortChannel0001.
        self.create_port_channel(dvs, lag)

        # 2. Add Ethernet0 to PortChannel0001.
        self.create_port_channel_member(dvs, lag, p.get_name())
        time.sleep(2)

        # 3. Add log marker to syslog
        marker = dvs.add_log_marker()

        # 4. Delete Ethernet0 from config DB.
        p.delete_from_config_db()
        time.sleep(2)

        # 5. Verify that we are waiting in portsorch for the port
        #    to be removed from LAG, by looking at the log
        self.check_syslog(dvs, marker,
                          "Unable to remove port Ethernet0: ref count 1", 1)

        # 6. Also verify that port is still present in ASIC DB.
        assert (p.exists_in_asic_db() == True)

        # 7. Remove port from LAG
        self.remove_port_channel_member(dvs, lag, p.get_name())

        # 8. Verify that port is removed from ASIC DB
        assert (p.not_exists_in_asic_db() == True)

        # 9. Re-create port Ethernet0 and verify that it is
        #    present in CONFIG, APPL, and ASIC DBs
        p.write_to_config_db()
        p.verify_config_db()
        p.verify_app_db()
        p.verify_asic_db()

        # 10. Remove PortChannel0001 and verify that its removed.
        self.remove_port_channel(dvs, lag)
        self.dvs_lag.get_and_verify_port_channel(0)
コード例 #2
0
    def test_dependency(self, dvs):
        vlan = "100"
        p = Port(dvs, "Ethernet0")
        p.sync_from_config_db()

        # 1. Create VLAN100
        self.dvs_vlan.create_vlan(vlan)

        # 2. Add Ethernet0 to VLAN100
        self.dvs_vlan.create_vlan_member(vlan, p.get_name())

        # 3. Add log marker to syslog
        marker = dvs.add_log_marker()

        # 4. Delete Ethernet0 from config DB. Sleep for 2 seconds.
        p.delete_from_config_db()
        time.sleep(2)

        # 5. Verify that we are waiting in portsorch for the port
        #    to be removed from VLAN, by looking at the log
        self.check_syslog(dvs, marker,
                          "Cannot remove port as bridge port OID is present",
                          1)

        # 6. Also verify that port is still present in ASIC DB.
        assert (p.exists_in_asic_db() == True)

        # 7. Remove port from VLAN
        self.dvs_vlan.remove_vlan_member(vlan, p.get_name())

        # 8. Verify that port is removed from ASIC DB
        assert (p.not_exists_in_asic_db() == True)

        # 9. Re-create port Ethernet0 and verify that it is
        #    present in CONFIG, APPL, and ASIC DBs
        p.write_to_config_db()
        p.verify_config_db()
        p.verify_app_db()
        p.verify_asic_db()

        # 10. Remove VLAN100 and verify that its removed.
        self.dvs_vlan.remove_vlan(vlan)
        self.dvs_vlan.get_and_verify_vlan_ids(0)
コード例 #3
0
    def test_one_port_one_vlan(self, dvs):
        dpb = DPB()
        vlan = "100"

        # 1. Create VLAN100 and add Ethernet0 as member
        self.dvs_vlan.create_vlan(vlan)
        self.dvs_vlan.create_vlan_member(vlan, "Ethernet0")
        self.dvs_vlan.get_and_verify_vlan_member_ids(1)

        # 2. Delete Ethernet0 from config DB. Verify that its deleted
        #    CONFIG and APPL DB and its still present in ASIC DB
        p = Port(dvs, "Ethernet0")
        p.sync_from_config_db()
        p.delete_from_config_db()
        assert (p.exists_in_config_db() == False)
        assert (p.exists_in_app_db() == False)
        assert (p.exists_in_asic_db() == True)

        # 3. Verify that Ethernet0 gets deleted from ASIC DB once
        #    its removed from VLAN100.
        self.dvs_vlan.remove_vlan_member(vlan, "Ethernet0")
        self.dvs_vlan.get_and_verify_vlan_member_ids(0)
        assert (p.not_exists_in_asic_db() == True)

        # 4. To simulate port breakout, 1x100G --> 4x25G, create 4 ports
        dpb.create_child_ports(dvs, p, 4)

        # 5. Add all 4 ports to VLAN100
        port_names = ["Ethernet0", "Ethernet1", "Ethernet2", "Ethernet3"]
        vlan_member_count = 0
        for pname in port_names:
            self.dvs_vlan.create_vlan_member(vlan, pname)
            vlan_member_count = vlan_member_count + 1
            self.dvs_vlan.get_and_verify_vlan_member_ids(vlan_member_count)

        # 6. Delete 4 ports from CONFIG DB. Verify that they are all deleted
        #    from CONFIG and APPL DB but still present in ASIC DB
        child_ports = []
        for pname in port_names:
            cp = Port(dvs, pname)
            cp.sync_from_config_db()
            cp.delete_from_config_db()
            assert (cp.exists_in_config_db() == False)
            assert (cp.exists_in_app_db() == False)
            assert (cp.exists_in_asic_db() == True)
            child_ports.append(cp)

        # 7. Remove all 4 ports from VLAN100 and verify that they all get
        #    deleted from ASIC DB
        for cp in child_ports:
            self.dvs_vlan.remove_vlan_member(vlan, cp.get_name())
            vlan_member_count = vlan_member_count - 1
            self.dvs_vlan.get_and_verify_vlan_member_ids(vlan_member_count)
            assert (cp.not_exists_in_asic_db() == True)

        # 8. Re-create Ethernet0 and verify that its created all 3 DBs
        p.write_to_config_db()
        p.verify_config_db()
        p.verify_app_db()
        p.verify_asic_db()

        # 9. Remove VLAN100 and verify the same
        self.dvs_vlan.remove_vlan(vlan)
        self.dvs_vlan.get_and_verify_vlan_ids(0)