示例#1
0
    def runTest(self):
        sflow_cfg = {}
        sflow_cfg['device-id'] = cfg.leaf0['id']
        sflow_cfg['data'] = {
            "collector_ip": "192.168.2.20",
            "max_payload_length": 1500,
            "max_header_length": 256,
            "polling_interval": 10000000,
            "sample_rate": 16777215,
            "port": [3],
            "duration": 10000000
        }

        sflow = SFLOW(sflow_cfg)
        sflow.delete_deviceByIdNotVerify(cfg.leaf0['id'])
        sflow.delete_deviceByIdNotVerify(cfg.leaf1['id'])
        sflow.delete_deviceByIdNotVerify(cfg.spine0['id'])

        actual_device = sflow.build()

        actual_device = sflow.get_deviceById(cfg.leaf0['id'])
        assert ("192.168.2.20" == actual_device["controllerIp"]
                ), "collector_ip setup fail"
        assert (1500 == actual_device["maxPayloadLength"]
                ), "'maxPayloadLength setup fail"
        assert (10000000 == actual_device["duration"]), "duration setup fail"
        assert (10000000 == actual_device["pollingInterval"]
                ), "pollingInterval setup fail"
        assert (16777215 == actual_device["samplingRate"]
                ), "samplingRate setup fail"
        assert (256 == actual_device["maxHeaderLength"]
                ), "maxHeaderLength setup fail"
示例#2
0
    def runTest(self):
        sflow_cfg = {}
        sflow_cfg['device-id'] = cfg.leaf0['id']
        sflow_cfg['data'] = {
            "collector_ip": "192.168.2.20",
            "max_payload_length": 1500,
            "max_header_length": 64,
            "polling_interval": 10000000,
            "sample_rate": 16777215,
            "port": [1],
            "duration": 10000000
        }

        sflow = SFLOW(sflow_cfg)
        sflow.delete_deviceByIdNotVerify(cfg.leaf0['id'])
        sflow.delete_deviceByIdNotVerify(cfg.leaf1['id'])
        sflow.delete_deviceByIdNotVerify(cfg.spine0['id'])

        actual_device = sflow.build()

        actual_device = sflow.get_deviceById(cfg.leaf0['id'])
        assert ("192.168.2.20" == actual_device["controllerIp"]
                ), "collector_ip setup fail"
        assert (64 == actual_device["maxHeaderLength"]
                ), "maxHeaderLength setup fail"

        sflow_cfg['data'] = {
            "collector_ip": "192.168.2.20",
            "max_payload_length": 1500,
            "max_header_length": 256,
            "polling_interval": 10000000,
            "sample_rate": 16777215,
            "port": [1],
            "duration": 10000000
        }
        actual_device = sflow.buildNotSuccess()

        #print("Debug: Build sflow rule not success ==> pass")
        actual_device = sflow.get_deviceById(cfg.leaf0['id'])
        assert (64 == actual_device["maxHeaderLength"]
                ), "maxHeaderLength setup fail"
示例#3
0
    def runTest(self):
        sflow_cfg = {}
        sflow_cfg['device-id'] = cfg.leaf0['id']
        sflow_cfg['data'] = {
            "collector_ip": "192.168.2.20",
            "max_payload_length": 1500,
            "max_header_length": 256,
            "polling_interval": 10000000,
            "sample_rate": 16777215,
            "port": [1],
            "duration": 10000000
        }

        sflow = SFLOW(sflow_cfg)
        sflow.delete_deviceByIdNotVerify(cfg.leaf0['id'])
        sflow.delete_deviceByIdNotVerify(cfg.leaf1['id'])
        sflow.delete_deviceByIdNotVerify(cfg.spine0['id'])

        actual_device = sflow.build()

        actual_device = sflow.get_deviceById(cfg.leaf0['id'])
        assert (
            10000000 == actual_device["duration"]), "duration setup fail(c1)"

        sflow_cfg['data'] = {
            "collector_ip": "192.168.2.20",
            "max_payload_length": 200,
            "max_header_length": 256,
            "polling_interval": 10000000,
            "sample_rate": 256,
            "port": [1],
            "duration": 30
        }
        actual_device = sflow.buildNotSuccess()

        actual_device = sflow.get_deviceById(cfg.leaf0['id'])
        assert (
            10000000 == actual_device["duration"]), "duration setup fail(c2)"
示例#4
0
    def runTest(self):
        ports = sorted(config["port_map"].keys())
        vlan_cfg = {}
        vlan_cfg['device-id'] = cfg.leaf0['id']
        vlan_cfg_sw1 = {}
        vlan_cfg_sw1['device-id'] = cfg.leaf0['id']
        sflow_cfg = {}
        sflow_cfg['device-id'] = [cfg.leaf0['id']]

        sflow = SFLOW(sflow_cfg)
        sflow.delete_deviceByIdNotVerify(cfg.leaf0['id'])
        sflow.delete_deviceByIdNotVerify(cfg.leaf1['id'])
        sflow.delete_deviceByIdNotVerify(cfg.spine0['id'])

        vlan_cfg['device-id'] = cfg.leaf1['id']
        vlan_cfg['vlans'] = [{
            "vlan": 1,
            "ip": "10.0.10.113",
            "mask": "255.255.255.0"
        }]
        vlan = VLAN(vlan_cfg).build()

        sflow_cfg['device-id'] = cfg.leaf1['id']
        sflow_cfg['data'] = {
            "collector_ip": "10.0.10.13",
            "max_payload_length": 200,
            "max_header_length": 64,
            "polling_interval": 3,
            "sample_rate": 256,
            "port": [1],
            "duration": 30
        }
        actual_device = sflow.build()

        #part 2
        vlan_cfg['device-id'] = cfg.leaf0['id']
        vlan_cfg['vlans'] = [{
            "vlan": 1,
            "ip": "10.0.10.111",
            "mask": "255.255.255.0"
        }]
        vlan = VLAN(vlan_cfg).build()

        sflow_cfg['device-id'] = cfg.leaf0['id']
        sflow_cfg['data'] = {
            "collector_ip": "10.0.10.13",
            "max_payload_length": 200,
            "max_header_length": 64,
            "polling_interval": 3,
            "sample_rate": 256,
            "port": [1],
            "duration": 30
        }
        actual_device = sflow.build()
        time.sleep(35)
        vlan_cfg['device-id'] = cfg.leaf1['id']
        vlan = StaticVLAN(vlan_cfg)
        vlan.delete_DevieIdNoVerify({'device-id': cfg.leaf0['id']})
        vlan.delete_DevieIdNoVerify({'device-id': cfg.leaf1['id']})

        #actual_device = sflow.delete_deviceById(cfg.leaf0['id'])
        #time.sleep(2)
        #actual_device = sflow.delete_deviceById(cfg.leaf1['id'])
        #time.sleep(2)
        actual_device = sflow.get_deviceById(cfg.leaf1['id'])
        assert ({} == actual_device), "delete leaf1 fail"

        actual_device = sflow.get_deviceById(cfg.leaf0['id'])
        assert ({} == actual_device), "delete leaf0 fail"
示例#5
0
    def runTest(self):
        sflow_cfg = {}
        sflow = SFLOW(sflow_cfg)
        sflow.delete_deviceByIdNotVerify(cfg.leaf0['id'])
        sflow.delete_deviceByIdNotVerify(cfg.leaf1['id'])
        sflow.delete_deviceByIdNotVerify(cfg.spine0['id'])

        sflow_cfg['device-id'] = cfg.leaf0['id']
        sflow_cfg['data'] = {
            "collector_ip": "192.168.2.10",
            "max_payload_length": 1500,
            "max_header_length": 256,
            "polling_interval": 10000000,
            "sample_rate": 16777215,
            "port": [1],
            "duration": 10000000
        }
        actual_device = sflow.build()

        sflow_cfg['device-id'] = cfg.leaf1['id']
        sflow_cfg['data'] = {
            "collector_ip": "192.168.2.20",
            "max_payload_length": 1500,
            "max_header_length": 256,
            "polling_interval": 10000000,
            "sample_rate": 16777215,
            "port": [1],
            "duration": 10000000
        }
        actual_device = sflow.build()

        sflow_cfg['device-id'] = cfg.spine0['id']
        sflow_cfg['data'] = {
            "collector_ip": "192.168.2.30",
            "max_payload_length": 1500,
            "max_header_length": 256,
            "polling_interval": 10000000,
            "sample_rate": 16777215,
            "port": [1],
            "duration": 10000000
        }
        actual_device = sflow.build()

        actual_device = sflow.get_deviceById(cfg.leaf0['id'])
        assert ("192.168.2.10" == actual_device["controllerIp"]
                ), "1:collector_ip setup fail"

        actual_device = sflow.get_deviceById(cfg.leaf1['id'])
        assert ("192.168.2.20" == actual_device["controllerIp"]
                ), "2:collector_ip setup fail"

        actual_device = sflow.get_deviceById(cfg.spine0['id'])
        assert ("192.168.2.30" == actual_device["controllerIp"]
                ), "3:collector_ip setup fail"

        actual_device = sflow.delete_deviceById(cfg.leaf0['id'])

        actual_device = sflow.get_deviceById(cfg.leaf0['id'])
        assert ({} == actual_device), "delete leaf0 fail"

        actual_device = sflow.delete_deviceById(cfg.leaf1['id'])

        actual_device = sflow.get_deviceById(cfg.leaf1['id'])
        assert ({} == actual_device), "delete leaf1 fail"

        actual_device = sflow.delete_deviceById(cfg.spine0['id'])

        actual_device = sflow.get_deviceById(cfg.spine0['id'])
        assert ({} == actual_device), "delete spine fail"
示例#6
0
    def runTest(self):
        ports = sorted(config["port_map"].keys())
        vlan_cfg = {}
        vlan_cfg['device-id'] = cfg.leaf0['id']
        vlan_cfg_sw1 = {}
        vlan_cfg_sw1['device-id'] = cfg.leaf0['id']
        sflow_cfg = {}
        sflow_cfg['device-id'] = [cfg.leaf0['id']]

        sflow = SFLOW(sflow_cfg)
        sflow.delete_deviceByIdNotVerify(cfg.leaf0['id'])
        sflow.delete_deviceByIdNotVerify(cfg.leaf1['id'])
        sflow.delete_deviceByIdNotVerify(cfg.spine0['id'])

        vlan_cfg['device-id'] = cfg.leaf1['id']
        vlan = StaticVLAN(vlan_cfg)
        vlan.delete_DevieIdNoVerify({'device-id': cfg.leaf0['id']})
        vlan.delete_DevieIdNoVerify({'device-id': cfg.leaf1['id']})

        vlan_cfg['device-id'] = cfg.leaf1['id']
        vlan_cfg['vlans'] = [{
            "vlan": 1,
            "ip": "10.0.10.113",
            "mask": "255.255.255.0"
        }]
        vlan = VLAN(vlan_cfg).build()

        vlan_cfg['device-id'] = cfg.leaf0['id']
        vlan_cfg['vlans'] = [{
            "vlan": 1,
            "ip": "10.0.10.111",
            "mask": "255.255.255.0"
        }]
        vlan = VLAN(vlan_cfg).build()

        sflow_cfg['device-id'] = cfg.leaf1['id']
        sflow_cfg['data'] = {
            "collector_ip": "10.0.10.14",
            "max_payload_length": 200,
            "max_header_length": 100,
            "polling_interval": 3,
            "sample_rate": 256,
            "port": [1],
            "duration": 10000
        }
        actual_device = sflow.build()

        sflow_cfg['device-id'] = cfg.leaf0['id']
        sflow_cfg['data'] = {
            "collector_ip": "10.0.10.14",
            "max_payload_length": 300,
            "max_header_length": 200,
            "polling_interval": 3,
            "sample_rate": 256,
            "port": [1],
            "duration": 10000
        }
        actual_device = sflow.build()

        rebootTest = RebootSwitch(cfg.leaf0['id'])
        rebootTest.reboot()

        rebootTest = RebootSwitch(cfg.leaf1['id'])
        rebootTest.reboot()

        time.sleep(180)
        actual_device = sflow.get_deviceById(cfg.leaf0['id'])
        assert (3 == actual_device["pollingInterval"]
                ), "Verify pollingInterval fail by reboot(leaf0)"
        actual_device = sflow.get_deviceById(cfg.leaf1['id'])
        assert (3 == actual_device["pollingInterval"]
                ), "Verify pollingInterval fail by reboot(leaf1)"