Exemplo n.º 1
0
    def runTest(self):
        poe_cfg = {}
        poe_cfg['device-id'] = cfg.leaf1['id']
        poeData = PoE(poe_cfg)
        actual_port = poeData.get_configById()
        assert (cfg.leaf1['id'] in actual_port), "Cannot get poe config by id"
        poeCfgData = {
            "ports": [1],
            "status": "true",
            "priority": 1,
            "maxPower": 20000,
            "timeRange": ""
        }
        poeData.put_PortMaxPowerById(poeCfgData)
        time.sleep(3)
        actual_port = poeData.get_portConfigById()
        assert (cfg.leaf1['id'] in actual_port), "Cannot get poe config"
        chkData = actual_port[cfg.leaf1['id']]
        assert (20000 == chkData[0]["maxPower"]
                ), "Cannot put maxPower of port of poe"

        poeCfgData = {
            "ports": [1],
            "status": "true",
            "priority": 1,
            "maxPower": 30000,
            "timeRange": ""
        }
        poeData.put_PortMaxPowerById(poeCfgData)
        time.sleep(3)
        actual_port = poeData.get_portConfigById()
        assert (cfg.leaf1['id'] in actual_port), "Cannot get poe config"
        chkData = actual_port[cfg.leaf1['id']]
        assert (30000 == chkData[0]["maxPower"]
                ), "Cannot put maxPower of port of poe"
Exemplo n.º 2
0
    def runTest(self):
        poe_cfg = {}
        poe_cfg['device-id'] = cfg.leaf1['id']
        poeData = PoE(poe_cfg)
        actual_port = poeData.get_configById()
        assert (cfg.leaf1['id'] in actual_port), "Cannot get poe config by id"
        chkData = actual_port[cfg.leaf1['id']][0]["threshold"]
        setData = 0
        if chkData > 5:
            setData = chkData - 5
        else:
            setData = chkData + 5
        poeData.put_MainThresholdById(setData)
        time.sleep(5)
        actual_port = poeData.get_configById()
        assert (cfg.leaf1['id'] in actual_port), "Cannot get poe config by id"
        chkNewData = actual_port[cfg.leaf1['id']][0]["threshold"]
        assert (setData == chkNewData), "Cannot put threshold of main by id"

        # reboot
        rebootTest = RebootSwitch(cfg.leaf0['id'])
        rebootTest.reboot()
        rebootTest = RebootSwitch(cfg.leaf1['id'])
        rebootTest.reboot()
        time.sleep(300)

        actual_port = poeData.get_configById()
        assert (cfg.leaf1['id'] in actual_port), "Cannot get poe config by id"
        chkNewData = actual_port[cfg.leaf1['id']][0]["threshold"]
        assert (setData == chkNewData), "Cannot put threshold of main by id"
Exemplo n.º 3
0
 def runTest(self):
     poe_cfg = {}
     poe_cfg['device-id'] = cfg.leaf1['id']
     poeData = PoE(poe_cfg)
     actual_port = poeData.get_configById()
     assert (cfg.leaf1['id'] in actual_port), "Cannot get poe config by id"
     chkData = actual_port[cfg.leaf1['id']][0]["threshold"]
     setData = 0
     if chkData > 5:
         setData = chkData - 5
     else:
         setData = chkData + 5
     poeData.put_MainThresholdById(setData)
     actual_port = poeData.get_configById()
     assert (cfg.leaf1['id'] in actual_port), "Cannot get poe config by id"
     chkNewData = actual_port[cfg.leaf1['id']][0]["threshold"]
     assert (setData == chkNewData), "Cannot put threshold of main by id"
Exemplo n.º 4
0
    def runTest(self):
        poe_cfg = {}
        poe_cfg['device-id'] = cfg.leaf1['id']
        poeData = PoE(poe_cfg)
        actual_port = poeData.get_configById()
        assert (cfg.leaf1['id'] in actual_port), "Cannot get poe config by id"

        timeRange = {}
        timeRange['device-id'] = cfg.leaf1['id']
        timeRange["name"] = "time1"
        timeRange["periodic"] = [{
            "start": {
                "day": "sunday",
                "hour": 2,
                "minute": 3
            },
            "end": {
                "day": "monday",
                "hour": 4,
                "minute": 5
            }
        }]
        timeRangeData1 = TimeRange(timeRange)
        timeRangeData1.build()
        timeRange["name"] = "time2"
        timeRange["periodic"] = [{
            "start": {
                "day": "daily",
                "hour": 2,
                "minute": 3
            },
            "end": {
                "day": "daily",
                "hour": 4,
                "minute": 5
            }
        }]
        timeRangeData2 = TimeRange(timeRange)
        timeRangeData2.build()

        poe_cfg = {}
        poe_cfg['device-id'] = cfg.leaf1['id']
        poeData = PoE(poe_cfg)
        poeCfgData = {
            "ports": [1],
            "status": "true",
            "priority": 2,
            "maxPower": 10000,
            "timeRange": "time1"
        }
        poeData.put_PortMaxPowerById(poeCfgData)
        time.sleep(5)
        actual_port = poeData.get_portConfigById()
        assert (cfg.leaf1['id'] in actual_port), "Cannot get poe config"
        chkData = actual_port[cfg.leaf1['id']][0]
        assert (poeCfgData["maxPower"] == chkData["maxPower"]
                ), "Cannot put maxPower of port of poe"
        assert (True == chkData["status"]), "Cannot put status of port of poe"
        assert (poeCfgData["priority"] == chkData["priority"]
                ), "Cannot put priority of port of poe"
        # assert(poeCfgData["timeRange"] == chkData["timeRange"]
        #       ), "Cannot put timeRange of port of poe"

        poe_cfg = {}
        poe_cfg['device-id'] = cfg.leaf1['id']
        poeData = PoE(poe_cfg)
        poeCfgData = {
            "ports": [2],
            "status": "true",
            "priority": 1,
            "maxPower": 20000,
            "timeRange": "time2"
        }
        poeData.put_PortMaxPowerById(poeCfgData)
        time.sleep(5)
        actual_port = poeData.get_portConfigById()
        assert (cfg.leaf1['id'] in actual_port), "Cannot get poe config"
        chkData = actual_port[cfg.leaf1['id']][1]
        assert (poeCfgData["maxPower"] == chkData["maxPower"]
                ), "Cannot put maxPower of port of poe"
        assert (True == chkData["status"]), "Cannot put status of port of poe"
        assert (poeCfgData["priority"] == chkData["priority"]
                ), "Cannot put priority of port of poe"
Exemplo n.º 5
0
 def runTest(self):
     poe_cfg = {}
     poe_cfg['device-id'] = cfg.leaf1['id']
     poeData = PoE(poe_cfg)
     actual_port = poeData.get_portConfigById()
     assert (cfg.leaf1['id'] in actual_port), "Cannot get poe config"