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