Beispiel #1
0
    def runTest(self):
        pppoeia_cfg = {}
        pppoeia_cfg['device-id'] = [cfg.leaf0['id']]
        pppoeia = PPPoEIA(pppoeia_cfg)
        actual_device = pppoeia.get_devicePort()

        assert ("ports" in actual_device), "cannot get pppoe ia port"
Beispiel #2
0
    def runTest(self):
        pppoeia_cfg = {}
        pppoeia_cfg['device-id'] = [cfg.leaf0['id']]
        pppoeia = PPPoEIA(pppoeia_cfg)
        actual_device = pppoeia.get_devicePortStats()

        assert ("statistics"
                in actual_device), "cannot get pppoe ia statistics data"
Beispiel #3
0
 def runTest(self):
     pppoeia_cfg = {}
     pppoeia_cfg['device-id'] = [cfg.leaf0['id']]
     pppoeia = PPPoEIA(pppoeia_cfg)
     actual_device = pppoeia.get_device()
     assert ("delegateDevices"
             in actual_device), "Can not get pppoe ia rule of device"
     assert ("devices"
             in actual_device), "Can not get pppoe ia rule of device"
Beispiel #4
0
    def runTest(self):
        pppoeia_cfg = {}
        pppoeia_cfg['device-id'] = [cfg.leaf0['id']]
        pppoeia = PPPoEIA(pppoeia_cfg)
        actual_device = pppoeia.get_devicePortStatsById(cfg.leaf0['id'])

        assert ("statistics"
                in actual_device), "cannot get pppoe ia port statistics"
        assert (cfg.leaf0['id'] == actual_device["statistics"][0]["deviceId"]
                ), "cannot get pppoe ia port statistics"
Beispiel #5
0
    def runTest(self):
        pppoeia_cfg = {}
        pppoeia_cfg['device-id'] = cfg.leaf0['id']
        pppoeia_cfg['data'] = {"status": "true"}

        pppoeia = PPPoEIA(pppoeia_cfg)
        actual_device = pppoeia.put_pppoeiaById(cfg.leaf0['id'])
        actual_device = pppoeia.get_device()
        assert ("delegateDevices"
                in actual_device), "Can not get pppoe ia rule of device"
        assert ("devices"
                in actual_device), "Can not get pppoe ia rule of device"
        testStatus = "false"
        for dictData in actual_device["devices"]:
            #print("debug pppoe status:", dictData)
            if dictData["deviceId"] == cfg.leaf0['id']:
                if dictData["status"] == True: testStatus = "true"
        assert ("true" == testStatus), "Can not put status of {}".format(
            cfg.leaf0['id'])

        pppoeia_cfg['data'] = {"status": "false"}
        pppoeia = PPPoEIA(pppoeia_cfg)
        actual_device = pppoeia.put_pppoeiaById(cfg.leaf0['id'])
        actual_device = pppoeia.get_device()
        assert ("delegateDevices"
                in actual_device), "Can not get pppoe ia rule of device"
        assert ("devices"
                in actual_device), "Can not get pppoe ia rule of device"
        testStatus = "false"
        for dictData in actual_device["devices"]:
            #print("debug pppoe status:", dictData)
            if dictData["deviceId"] == cfg.leaf0['id']:
                if dictData["status"] == False: testStatus = "true"
        assert ("true" == testStatus), "Can not put status of {}".format(
            cfg.leaf0['id'])
Beispiel #6
0
    def runTest(self):
        pppoeia_cfg = {}
        pppoeia_cfg['device-id'] = cfg.leaf0['id']
        pppoeia_cfg['data'] = {"delegateDevices": ["rest:192.168.40.176:80/2"]}

        pppoeia = PPPoEIA(pppoeia_cfg)
        actual_device = pppoeia.build()
        actual_device = pppoeia.get_device()
        assert ("delegateDevices"
                in actual_device), "Can not get pppoe ia rule of device"
        assert ("devices"
                in actual_device), "Can not get pppoe ia rule of device"
        assert ("rest:192.168.40.176:80/2" in actual_device["delegateDevices"]
                ), "Can not set rest:192.168.40.176:80/2 of agent"

        pppoeia_cfg = {}
        pppoeia_cfg['device-id'] = cfg.leaf0['id']
        pppoeia_cfg['data'] = {"delegateDevices": ["rest:192.168.40.176:80/3"]}

        pppoeia = PPPoEIA(pppoeia_cfg)
        actual_device = pppoeia.put_delegate()
        actual_device = pppoeia.get_device()
        assert ("delegateDevices"
                in actual_device), "Can not get pppoe ia rule of device"
        assert ("devices"
                in actual_device), "Can not get pppoe ia rule of device"
        assert ("rest:192.168.40.176:80/3" in actual_device["delegateDevices"]
                ), "Can not set rest:192.168.40.176:80/2 of agent"
Beispiel #7
0
    def runTest(self):

        pppoeia_cfg = {}
        pppoeia_cfg['data'] = {"status": "true"}
        pppoeia = PPPoEIA(pppoeia_cfg)
        actual_device = pppoeia.put_pppoeiaById(cfg.leaf0['id'])

        pppoeia_cfg['data'] = {
            "delegateDevices": ["{}/{}".format(cfg.leaf0['id'], 2)]
        }
        pppoeia = PPPoEIA(pppoeia_cfg)
        actual_device = pppoeia.build()

        pppoeia_cfg['device-id'] = cfg.leaf0['id']
        pppoeia_cfg['data'] = {
            "hostPort": "true",
            "stripVendor": "true",
            "circuitId": "port1_1",
            "remoteId": ""
        }
        pppoeia = PPPoEIA(pppoeia_cfg)
        actual_device = pppoeia.put_pppoeiaByIdAndPort(cfg.leaf0['id'], 1)

        pppoeia_cfg['device-id'] = cfg.leaf1['id']
        pppoeia_cfg['data'] = {
            "hostPort": "true",
            "stripVendor": "false",
            "circuitId": "port1_2",
            "remoteId": ""
        }
        pppoeia = PPPoEIA(pppoeia_cfg)
        actual_device = pppoeia.put_pppoeiaByIdAndPort(cfg.leaf1['id'], 1)
        wait_for_seconds(4)

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

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

        actual_device = pppoeia.get_device()
        testStatus = "false"
        for dictData in actual_device["devices"]:
            #print("debug pppoe status:", dictData)
            if dictData["deviceId"] == cfg.leaf0['id']:
                if dictData["status"] == True: testStatus = "true"
        assert ("true" == testStatus), "Can not put status of {}".format(
            cfg.leaf0['id'])

        assert("{}/{}".format(cfg.leaf0['id'], 2) in actual_device["delegateDevices"]), \
            "Can not set {}/{} of agent".format(cfg.leaf0['id'],2)

        actual_device = pppoeia.get_devicePortById(cfg.leaf0['id'])
        #print("debug pppoe status:", actual_device)
        assert (actual_device["ports"][0]["deviceId"] == cfg.leaf0['id']
                ), "Can not get device id"
        assert (actual_device["ports"][0]["hostPort"] == True
                ), "pppoe hostPort value error1"
        assert (actual_device["ports"][0]["stripVendor"] == True
                ), "pppoe stripVendor value error1"
        assert (actual_device["ports"][0]["circuitId"] == "port1_1"
                ), "pppoe circuitId value error1"
        assert (actual_device["ports"][0]["remoteId"] == ""
                ), "pppoe remoteId value error1"

        actual_device = pppoeia.get_devicePortById(cfg.leaf1['id'])
        assert (actual_device["ports"][0]["deviceId"] == cfg.leaf1['id']
                ), "Can not get device id"
        assert (actual_device["ports"][0]["hostPort"] == True
                ), "pppoe hostPort value error1"
        assert (actual_device["ports"][0]["stripVendor"] == False
                ), "pppoe stripVendor value error1"
        assert (actual_device["ports"][0]["circuitId"] == "port1_2"
                ), "pppoe circuitId value error2"
        assert (actual_device["ports"][0]["remoteId"] == ""
                ), "pppoe remoteId value error2"
Beispiel #8
0
    def runTest(self):
        ports = sorted(config["port_map"].keys())
        vlan_cfg = {}
        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()

        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()

        #reset delault
        pppoeia_cfg = {}
        pppoeia_cfg['data'] = {"status": "false"}
        pppoeia = PPPoEIA(pppoeia_cfg)
        actual_device = pppoeia.put_pppoeiaById(cfg.leaf0['id'])
        actual_device = pppoeia.put_pppoeiaById(cfg.leaf1['id'])
        actual_device = pppoeia.delete_deviceDelegatesById(cfg.leaf0['id'], 2)
        actual_device = pppoeia.delete_deviceDelegatesById(cfg.leaf0['id'], 3)
        actual_device = pppoeia.delete_deviceDelegatesById(cfg.leaf1['id'], 2)
        pppoeia_cfg['data'] = {
            "hostPort": "false",
            "stripVendor": "false",
            "circuitId": "",
            "remoteId": ""
        }
        pppoeia = PPPoEIA(pppoeia_cfg)
        actual_device = pppoeia.put_pppoeiaByIdAndPort(cfg.leaf0['id'], 1)
        actual_device = pppoeia.put_pppoeiaByIdAndPort(cfg.leaf1['id'], 1)

        #leaf0
        pppoeia_cfg = {}
        pppoeia_cfg['data'] = {"status": "true"}
        pppoeia = PPPoEIA(pppoeia_cfg)
        actual_device = pppoeia.put_pppoeiaById(cfg.leaf0['id'])

        pppoeia_cfg['data'] = {
            "hostPort": "true",
            "stripVendor": "true",
            "circuitId": "test_a",
            "remoteId": "test_b"
        }
        pppoeia = PPPoEIA(pppoeia_cfg)
        actual_device = pppoeia.put_pppoeiaByIdAndPort(cfg.leaf0['id'], 1)

        #leaf1
        pppoeia_cfg = {}
        pppoeia_cfg['data'] = {"status": "true"}
        pppoeia = PPPoEIA(pppoeia_cfg)
        actual_device = pppoeia.put_pppoeiaById(cfg.leaf1['id'])

        pppoeia_cfg['data'] = {
            "hostPort": "true",
            "stripVendor": "true",
            "circuitId": "test_a",
            "remoteId": "test_b"
        }
        pppoeia = PPPoEIA(pppoeia_cfg)
        actual_device = pppoeia.put_pppoeiaByIdAndPort(cfg.leaf1['id'], 1)
        wait_for_seconds(2)

        from struct import pack
        pkt_from_p1_to_p2 = simple_pppoeia_packet(
            pktlen=60,
            eth_dst='ff:ff:ff:ff:ff:ff',
            eth_src=cfg.host0['mac'],
            pppoe_paylen=12,
            pppoe_payload=pack("12B", 0x01, 0x01, 0, 0, 0x01, 0x03, 0, 0x04,
                               0x25, 0x1d, 0, 0))
        expected_pkt = simple_eth_packet(pktlen=14,
                                         eth_type=0x8863,
                                         eth_dst='ff:ff:ff:ff:ff:ff',
                                         eth_src=cfg.host0['mac'])
        self.dataplane.send(ports[2], str(pkt_from_p1_to_p2))
        wait_for_seconds(0.1)
        verify_no_packet(self, str(expected_pkt), ports[3])
Beispiel #9
0
    def runTest(self):
        pppoeia_cfg = {}
        pppoeia_cfg['device-id'] = cfg.leaf0['id']
        pppoeia_cfg['data'] = {
            "hostPort": "true",
            "stripVendor": "true",
            "circuitId": "port1",
            "remoteId": ""
        }

        pppoeia = PPPoEIA(pppoeia_cfg)
        actual_device = pppoeia.put_pppoeiaByIdAndPort(cfg.leaf0['id'], 1)
        actual_device = pppoeia.get_devicePortById(cfg.leaf0['id'])
        assert (actual_device["ports"][0]["deviceId"] == cfg.leaf0['id']
                ), "Can not get device id"
        assert (actual_device["ports"][0]["circuitId"] == "port1"
                ), "pppoe circuitId value error1"

        pppoeia_cfg['data'] = {
            "hostPort": "true",
            "stripVendor": "true",
            "circuitId": "test_cir",
            "remoteId": "test_remote"
        }
        pppoeia = PPPoEIA(pppoeia_cfg)
        actual_device = pppoeia.put_pppoeiaByIdAndPort(cfg.leaf0['id'], 1)
        actual_device = pppoeia.get_devicePortById(cfg.leaf0['id'])
        assert (actual_device["ports"][0]["deviceId"] == cfg.leaf0['id']
                ), "Can not get device id"
        assert (actual_device["ports"][0]["circuitId"] == "test_cir"
                ), "pppoe circuitId value error2"
        assert (actual_device["ports"][0]["remoteId"] == "test_remote"
                ), "pppoe remoteId value error2"

        pppoeia_cfg['data'] = {
            "hostPort": "true",
            "stripVendor": "false",
            "circuitId": "test_cir",
            "remoteId": "test_remote"
        }
        pppoeia = PPPoEIA(pppoeia_cfg)
        actual_device = pppoeia.put_pppoeiaByIdAndPort(cfg.leaf0['id'], 1)
        actual_device = pppoeia.get_devicePortById(cfg.leaf0['id'])
        assert (actual_device["ports"][0]["deviceId"] == cfg.leaf0['id']
                ), "Can not get device id"
        assert (actual_device["ports"][0]["stripVendor"] == False
                ), "pppoe stripVendor value error2"
        assert (actual_device["ports"][0]["hostPort"] == True
                ), "pppoe hostPort value error2"

        pppoeia_cfg['data'] = {
            "hostPort": "false",
            "stripVendor": "true",
            "circuitId": "test_cir",
            "remoteId": "test_remote"
        }
        pppoeia = PPPoEIA(pppoeia_cfg)
        actual_device = pppoeia.put_pppoeiaByIdAndPort(cfg.leaf0['id'], 1)
        actual_device = pppoeia.get_devicePortById(cfg.leaf0['id'])
        assert (actual_device["ports"][0]["deviceId"] == cfg.leaf0['id']
                ), "Can not get device id"
        assert (actual_device["ports"][0]["stripVendor"] == True
                ), "pppoe stripVendor value error2"
        assert (actual_device["ports"][0]["hostPort"] == False
                ), "pppoe hostPort value error2"