def verify_post_bgp_neighbors(self): info("\n#####################################################\n") info("# Testing POST for BGP_Neighbors #") info("\n#####################################################\n") status_code, response_data = execute_request( self.path_bgp, "POST", json.dumps(_DATA), self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.CREATED, ("Wrong status code %s " % status_code) info('\nPOST BGP router with the asn: ' + str(_DATA['configuration']['asn']) + ' passed successfully') status_code, response_data = execute_request( self.path_bgp_neighbors, "POST", json.dumps(_DATA_BGP_NEIGHBORS), self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.CREATED, ("Wrong status code %s " % status_code) info('\nPOST BGP neighbors with the ip: ' + str(_DATA_BGP_NEIGHBORS ['configuration']['ip_or_group_name']) + ' passed successfully\n') status_code, response_data = execute_request( self.path_bgp_neighbors_id, "GET", None, self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.OK, "Wrong status code %s " % status_code d = get_json(response_data) assert d['configuration'] == _DATA_BGP_NEIGHBORS_COPY['configuration'] info('Post test passed successfully')
def verify_get_bgp_routers(self): info("\n#####################################################\n") info("# Testing GET for BGP_Routers #") info("\n#####################################################\n") status_code, response_data = execute_request( self.path_id, "GET", None, self.SWITCH_IP, False, xtra_header=self.cookie_header) status_code == httplib.OK, ("Wrong status code %s " % status_code) d = get_json(response_data) assert d['configuration'] == _DATA_COPY['configuration'] info('GET for BGP router with asn: ' + str(_DATA['configuration']['asn']) + ' passed successfully')
def test_route_maps(self): status_code, response_data = execute_request( self.url, "GET", None, self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.OK, ("Wrong status code %s " % status_code) info('### Success in executing the rest command "GET" for ' + self.url + ' ###\n') info('### Success in Rest GET route_maps ###\n') d = get_json(response_data) assert d == [] info('### Success in Rest GET for route_maps ###\n')
def post_static_route(self, data): info("\n########## Test to Create Static Route " "##########\n") # Verify data new_path = self.PATH + "/%s/" % FROM_STATIC \ + STATIC_PREFIX.replace("/", HTML_SLASH) status_code, response_data = execute_request( new_path, "GET", None, self.SWITCH_IP, xtra_header=self.cookie_header) assert status_code == httplib.OK, "Failed to query route" json_data = get_json(response_data) assert json_data[CONFIG] == data[CONFIG], \ "Configuration data is not equal that posted data" info("### Configuration data validated ###\n") info("\n########## End Test to Create Static Route " "##########\n")
def verify_connected_route_categories(self): info("\n########## Test Verify Connected Route Categories " "##########\n") s1 = self.net.switches[0] # Get vrf_default uuid vrf_default_uuid = get_vrf_uuid(s1, "vrf_default") # Set other data from_type = "connected" # Set transaction data transact_data = \ insert_route % {"prefix": CONNECTED_PREFIX, "vrf": vrf_default_uuid, "from": from_type} cmd_transact = ovsdb_client_transact % transact_data info("Transaction: %s \n" % cmd_transact) info(cmd_transact + "\n") # Execute transaction output = s1.cmd(cmd_transact) output = output.rstrip("\r\n") info("Response output: %s \n" % output) # Verify data new_path = self.PATH + "/" + from_type + "/" \ + CONNECTED_PREFIX.replace("/", HTML_SLASH) status_code, response_data = execute_request( new_path, "GET", None, self.SWITCH_IP, xtra_header=self.cookie_header) assert status_code == httplib.OK, "Failed to query route" json_data = get_json(response_data) info("Response data: %s \n " % json_data) # Verify if the follows columns are categorized as status assert "prefix" in json_data[STATUS] assert "address_family" in json_data[STATUS] assert "sub_address_family" in json_data[STATUS] assert "metric" in json_data[STATUS] info("\n########## End Test Verify Connected Route Categories " "##########\n")
def verify_post_bgp_routers(self): info("\n#####################################################\n") info("# Testing POST for BGP_Routers #") info("\n#####################################################\n") status_code, response_data = execute_request( self.path_bgp, "POST", json.dumps(_DATA), self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.CREATED, ("Wrong status code %s " % status_code) status_code, response_data = execute_request( self.path_id, "GET", None, self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.OK, ("Wrong status code %s " % status_code) d = get_json(response_data) assert d['configuration'] == _DATA_COPY['configuration'] info('Successful')
def verify_post_bgp_routers(self): info("\n#####################################################\n") info("# Testing POST for BGP_Routers #") info("\n#####################################################\n") status_code, response_data = execute_request( self.path_bgp, "POST", json.dumps(_DATA), self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.CREATED, ("Wrong status code %s " % status_code) status_code, response_data = execute_request( self.path_id, "GET", None, self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.OK, ("Wrong status code %s " % status_code) d = get_json(response_data) assert d['configuration'] == _DATA_COPY['configuration'] info('Successful')
def verify_lag_ok(self, lagName, mode="active"): # assert status bond_hw_handle has value for static lag # assert status lacp_status bond_status ok for dynamic lag # Verify data self.PORT_PATH = self.PATH_PORTS + "/" + lagName for switch in [self.SWITCH_IP1, self.SWITCH_IP2]: info("### Checking switch " + switch + "###\n") status_code, response_data = execute_request( self.PORT_PATH, "GET", None, switch, False, xtra_header=self.cookie_header) assert status_code == httplib.OK,\ "Failed to query LAG " + lagName json_data = get_json(response_data) if mode != "off": assert json_data["status"]["lacp_status"]["bond_status"] \ == "ok" info("### Switch " + switch + " lag status is ok ###\n")
def dc_test_custom_validator_invalid_put(self): info("### Testing invalid PUT request ###\n") info("### Adding invalid number of BGP routers ###\n") DC_PUT_DATA["System"]["vrfs"]["vrf_default"] = DC_INVALID_BGP_CONFIGS status_code, response_data = execute_request( self.dc_put_url, "PUT", json.dumps(DC_PUT_DATA), self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.BAD_REQUEST, ("Wrong status code %s " % status_code) assert 'exceeded' in response_data, ('Error does not contain \ resources exceeded error') info("### Successfully executed PUT for url=%s ###\n" % self.dc_put_url) info("### Received expected non-successful HTTP status code ###\n") d = get_json(response_data) info(d['error'][1]['details'] + "\n") info("### Successfully retrieved validation error message ###\n")
def test_subsystems(self): status_code, response_data = execute_request( self.url, "GET", None, self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.OK, ("Wrong status code %s " % status_code) info('### Success in executing the rest command "GET" for url: ' + self.url + ' ###\n') info('### Success in Rest GET subsystem ###\n') d = get_json(response_data) assert self.subsys_url in d, 'Fail in checking the GET METHOD JSON \ response validation for Subsystems' info('### Success in Rest GET for Subsystems ###\n')
def logs_with_limit_None(self): info("\n########## Test to Validate logs with no limit for" + " pagination ##########\n") limit_test = None self.LOGS_PATH = self.PATH + "?offset=%s" % OFFSET_TEST status_code, response_data = execute_request( self.LOGS_PATH, "GET", None, self.SWITCH_IP, xtra_header=self.cookie_header) assert status_code == httplib.OK, "Wrong status code %s " % status_code info("### Status code is OK ###\n") assert response_data is not None, "Response data is empty" info("### Response data returned is not empty ###\n") json_data = get_json(response_data) info("### JSON data is in good shape ###\n") info("\n########## End Test to Validate logs with no limit for" " pagination ##########\n")
def logs_with_since_relative_filter(self): info("\n########## Test to Validate logs with since relative filter" + " ##########\n") bug_flag = True since_test = "1%20minute%20ago" self.LOGS_PATH = self.PATH + "?since=%s&offset=%s&limit=%s" % \ (since_test, OFFSET_TEST, LIMIT_TEST) info("logs path %s" % self.LOGS_PATH) status_code, response_data = execute_request( self.LOGS_PATH, "GET", None, self.SWITCH_IP, xtra_header=self.cookie_header) assert status_code == httplib.OK, "Wrong status code %s " % status_code info("### Status code is OK ###\n") assert response_data is not None, "Response data is empty" info("### Response data returned for logs with since filter ###\n") json_data = get_json(response_data) info("### JSON data is in good shape ###\n") assert len(json_data) <= LIMIT_TEST, "Pagination limit failed %s " \ % len(json_data) info("### Pagination for logs works fine ###\n") assert self.verify_timestamp(json_data), "Logs for incorrect \ timestamp also displayed" info("### Since filter for logs is working fine ###\n") info("\n########## End Test to Validate logs with since relative" + " filter ##########\n")
def logs_with_until_timestamp_filter(self): info("\n########## Test to Validate logs with until timestamp" + "##########\n") until_test = str(datetime.datetime.utcnow()).split('.')[0] until_test = until_test.replace(" ", "%20") self.LOGS_PATH = self.PATH + "?until=%s&offset=%s&limit=%s" % \ (until_test, OFFSET_TEST, LIMIT_TEST) status_code, response_data = execute_request( self.LOGS_PATH, "GET", None, self.SWITCH_IP, xtra_header=self.cookie_header) assert status_code == httplib.OK, "Wrong status code %s " \ % status_code info("### Status code is OK ###\n") assert response_data is not None, "Response data is empty" info("### Response data returned for logs with until timestamp" + "filter ###\n") json_data = get_json(response_data) info("### JSON data is in good shape ###\n") assert len(json_data) <= LIMIT_TEST, "Pagination limit failed %s " \ % len(json_data) info("### Pagination for logs works fine ###\n") assert self.verify_timestamp(json_data), "Logs for incorrect \ timestamp also displayed" info("### Until filter for logs is working fine ###\n") info("\n########## End Test to Validate logs with until timestamp" + "##########\n")
def test_interfaces(self): status_code, response_data = execute_request( self.url, "GET", None, self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.OK, ("Wrong status code %s " % status_code) info('### Success in executing the rest command "GET" for url: ' + self.url + ' ###\n') info('### Success in Rest GET interfaces ###\n') d = get_json(response_data) assert self.url_one in d, 'Failed in checking the GET METHOD \ JSON response validation for Interface 19' info('### Success in Rest GET for Interface 19 ###\n') assert self.url_two in d, 'Failed in checking the GET METHOD \ JSON response validation for Interface 10' info('### Success in Rest GET for Interface 10 ###\n') assert self.url_three in d, 'Failed in checking the GET METHOD \ JSON response validation for Interface 49-2' info('### Success in Rest GET for Interface 49-2 ###\n')
def verify_put_bgp_routers(self): info("\n#####################################################\n") info("# Testing PUT for BGP_Routers #") info("\n#####################################################\n") _DATA_COPY['configuration']['networks'] = ["10.10.1.0/24"] status_code, response_data = execute_request( self.path_id, "PUT", json.dumps(_DATA_COPY), self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.OK, ("Wrong status code %s " % status_code) status_code, response_data = execute_request( self.path_id, "GET", None, self.SWITCH_IP, False, xtra_header=self.cookie_header) status_code == httplib.OK, ("Wrong status code %s " % status_code) content = response_data d = get_json(content) assert d['configuration'] == _DATA_COPY['configuration'] info('Successful')
def verify_put_bgp_routers(self): info("\n#####################################################\n") info("# Testing PUT for BGP_Routers #") info("\n#####################################################\n") _DATA_COPY['configuration']['networks'] = ["10.10.1.0/24"] status_code, response_data = execute_request( self.path_id, "PUT", json.dumps(_DATA_COPY), self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.OK, ("Wrong status code %s " % status_code) status_code, response_data = execute_request( self.path_id, "GET", None, self.SWITCH_IP, False, xtra_header=self.cookie_header) status_code == httplib.OK, ("Wrong status code %s " % status_code) content = response_data d = get_json(content) assert d['configuration'] == _DATA_COPY['configuration'] info('Successful')
def test_ecmp_reshash_enable(self): # enable ecmp resilient hash ECMP_PATCH[0]["value"]["resilient_hash_enabled"] = \ ECMP_PATCH[0]["value"].pop(ECMP_PATCH[0]["value"].keys()[0]) ECMP_PATCH[0]["value"]["resilient_hash_enabled"] = TRUE status_code, response_data = execute_request( self.PATH, "PATCH", json.dumps(ECMP_PATCH), self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.NO_CONTENT, "Error patching ecmp "\ "resilient hash enable Status code: %s Response data: %s " \ % (status_code, response_data) info("### Enable Resilient Hash ECMP Patched. Status code is 204 " "NO CONTENT ###\n") # Verify data status_code, response_data = execute_request( self.PATH, "GET", None, self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.OK, "Failed to query ecmp config" json_data = get_json(response_data) assert json_data[ "configuration"]["ecmp_config"]["resilient_hash_enabled"]\ == TRUE, "ECMP resilient hash enable failed" info("### ECMP resilient hash enable validated ###\n")
def test_ecmp_srcport_disable(self): # disable ecmp source port ECMP_PATCH[0]["value"]["hash_srcport_enabled"] = \ ECMP_PATCH[0]["value"].pop(ECMP_PATCH[0]["value"].keys()[0]) ECMP_PATCH[0]["value"]["hash_srcport_enabled"] = FALSE status_code, response_data = execute_request( self.PATH, "PATCH", json.dumps(ECMP_PATCH), self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.NO_CONTENT, "Error patching ecmp src "\ "ecmp source port disable Status code: %s Response data: %s " \ % (status_code, response_data) info("Disable Source Port ECMP Patched. Status code is 204 " "NO CONTENT\n") # Verify data status_code, response_data = execute_request( self.PATH, "GET", None, self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.OK, "Failed to query ecmp config" json_data = get_json(response_data) assert \ json_data["configuration"]["ecmp_config"]["hash_srcport_enabled"] \ == FALSE, "ECMP source port disable failed" info("### ECMP source port disable validated ###\n")
def logs_with_syslog_filter(self): info("\n########## Test to Validate logs with SYSLOG_IDENTIFIER" + "filter ##########\n") syslog_identifier_test = "systemd" self.LOGS_PATH = self.PATH + \ "?SYSLOG_IDENTIFIER=%s&offset=%s&limit=%s" % \ (syslog_identifier_test, OFFSET_TEST, LIMIT_TEST) status_code, response_data = execute_request( self.LOGS_PATH, "GET", None, self.SWITCH_IP, xtra_header=self.cookie_header) assert status_code == httplib.OK, "Wrong status code %s " % status_code info("### Status code is OK ###\n") assert response_data is not None, "Response data is empty" info("### Response data returned for logs with syslog_identifier" + "filter ###\n") json_data = get_json(response_data) info("### JSON data is in good shape ###\n") assert len(json_data) <= LIMIT_TEST, "Pagination limit failed %s " \ % len(json_data) info("### Pagination for logs works fine ###\n") bug_flag = True for s in json_data: if s["SYSLOG_IDENTIFIER"] != syslog_identifier_test: bug_flag = False assert bug_flag, "Logs for incorrect daemon also displayed" info("### SYSLOG_IDENTIFIER filter for logs is working fine ###\n") info("\n########## End Test to Validate logs with SYSLOG_IDENTIFIER" + "filter ##########\n")
def test_ecmp_dstip_disable(self): # disable ecmp dest ip ECMP_PATCH[0]["value"]["hash_dstip_enabled"] = \ ECMP_PATCH[0]["value"].pop(ECMP_PATCH[0]["value"].keys()[0]) ECMP_PATCH[0]["value"]["hash_dstip_enabled"] = FALSE status_code, response_data = execute_request( self.PATH, "PATCH", json.dumps(ECMP_PATCH), self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.NO_CONTENT, \ "Error patching ecmp dest ip disable Status code:" \ "%s Response data: %s " % (status_code, response_data) info("### Disable Dest IP ECMP Patched. " "Status code is 204 NO CONTENT ###\n") # Verify data status_code, response_data = execute_request( self.PATH, "GET", None, self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.OK, "Failed to query ecmp config" json_data = get_json(response_data) assert json_data["configuration"]["ecmp_config"]["hash_dstip_enabled"]\ == FALSE, "ECMP dest IP disable failed" info("### ECMP dest IP disable validated ###\n")
def logs_with_priority_filter(self): info("\n########## Test to Validate logs with priority parameter \ ##########\n") self.LOGS_PATH = self.PATH + "?priority=%s&offset=%s&limit=%s" % \ (PRIORITY_TEST, OFFSET_TEST, LIMIT_TEST) status_code, response_data = execute_request( self.LOGS_PATH, "GET", None, self.SWITCH_IP, xtra_header=self.cookie_header) assert status_code == httplib.OK, "Wrong status code %s " % status_code info("### Status code is OK ###\n") assert response_data is not None, "Response data is empty" info("### Response data returned for logs with priority filter ###\n") json_data = get_json(response_data) info("### JSON data is in good shape ###\n") assert len(json_data) <= LIMIT_TEST, "Pagination limit failed %s " \ % len(json_data) info("### Pagination for logs works fine ###\n") flag = True for d in json_data: if int(d["PRIORITY"]) > PRIORITY_TEST: flag = False assert flag, "Logs for incorrect priority level displayed" info("### Priority filter for logs is working fine ###\n") info("\n########## End Test to Validate logs with priority \ parameters ##########\n")
def verify_put_bgp_neighbors(self): info("\n#####################################################\n") info("# Testing PUT for BGP_Neighbors #") info("\n#####################################################\n") _DATA_BGP_NEIGHBORS_COPY['configuration']['description'] = \ 'BGP_Neighbors' status_code, response_data = execute_request( self.path_bgp_neighbors_id, "PUT", json.dumps(_DATA_BGP_NEIGHBORS_COPY), self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.OK, "Wrong status code %s " % status_code status_code, response_data = execute_request( self.path_bgp_neighbors_id, "GET", None, self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.OK, "Wrong status code %s " % status_code d = get_json(response_data) d['configuration'].pop('capability', None) assert d['configuration'] == _DATA_BGP_NEIGHBORS_COPY['configuration'] info('PUT passed successfully')
def verify_put_bgp_neighbors(self): info("\n#####################################################\n") info("# Testing PUT for BGP_Neighbors #") info("\n#####################################################\n") _DATA_BGP_NEIGHBORS_COPY['configuration']['description'] = \ 'BGP_Neighbors' status_code, response_data = execute_request( self.path_bgp_neighbors_id, "PUT", json.dumps(_DATA_BGP_NEIGHBORS_COPY), self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.OK, "Wrong status code %s " % status_code status_code, response_data = execute_request( self.path_bgp_neighbors_id, "GET", None, self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.OK, "Wrong status code %s " % status_code d = get_json(response_data) d['configuration'].pop('capability', None) assert d['configuration'] == _DATA_BGP_NEIGHBORS_COPY['configuration'] info('PUT passed successfully')
def verify_get_bgp_neighbors(self): info("\n#####################################################\n") info("# Testing GET for BGP_Neighbors #") info("\n#####################################################\n") status_code, response_data = execute_request( self.path_bgp_neighbors, "GET", None, self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.OK, "Wrong status code %s " % status_code info('\nGET for BGP neighbors with asn: ' + str(_DATA['configuration']['asn']) + ' passed successfully\n') status_code, _response_data = execute_request( self.path_bgp_neighbors_id, "GET", None, self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.OK, "Wrong status code %s " % status_code d = get_json(_response_data) assert d['configuration'] == _DATA_BGP_NEIGHBORS_COPY['configuration'] info('GET for BGP neighbors with the ip: ' + str(_DATA_BGP_NEIGHBORS ['configuration']['ip_or_group_name']) + ' passed successfully')
def test_patch_port_int_admin(self): port_data = copy.deepcopy(PORT_DATA) int_data = copy.deepcopy(INT_DATA) self.PORT_PATH = self.PATH_PORTS + "/1" self.INT_PATH = self.PATH_INT + "/1" # Create port status_code, response_data = execute_request( self.PATH_PORTS, "POST", json.dumps(port_data), self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.CREATED, "Error creating a Port. Status"\ " code: %s Response data: %s " % (status_code, response_data) info("### Port Created. Status code is 201 CREATED ###\n") # Verify data status_code, response_data = execute_request( self.PORT_PATH, "GET", None, self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.OK, "Failed to query added Port" json_data = get_json(response_data) assert json_data["configuration"] == port_data["configuration"],\ "Configuration data is not equal that posted data" info("### Configuration data validated ###\n") info("\n########## Test to Validate Patch Port Int ##########\n") port_data["configuration"]["admin"] = "up" int_data["configuration"]["user_config"] = {} int_data["configuration"]["user_config"]["admin"] = "up" status_code, response_data = execute_request( self.PORT_PATH, "PATCH", json.dumps(ADM_PATCH_PRT), self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.NO_CONTENT, "Error patching a Port "\ "Status code: %s Response data: %s " % (status_code, response_data) info("### Port Patched. Status code is 204 NO CONTENT ###\n") # Verify data status_code, response_data = execute_request( self.PORT_PATH, "GET", None, self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.OK, "Failed to query patched Port" json_data = get_json(response_data) assert json_data["configuration"] == port_data["configuration"],\ "Configuration data is not equal that posted data" info("### Configuration data validated ###\n") status_code, response_data = execute_request( self.INT_PATH, "PATCH", json.dumps(ADM_PATCH_INT), self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.NO_CONTENT, "Error patching an "\ "Interface. Status code: %s Response data: %s "\ % (status_code, response_data) info("### Interface Patched. Status code is 204 NO CONTENT ###\n") # Verify data status_code, response_data = execute_request( self.INT_PATH, "GET", None, self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.OK, "Failed to query patched Port" json_data = get_json(response_data) assert json_data["configuration"] == int_data["configuration"],\ "Configuration data is not equal that posted data" info("### Configuration data validated ###\n") info("\n########## End Test Create And Patch Port Int ##########\n")
def test_patch_other(self): int_data = copy.deepcopy(INT_DATA) self.INT_PATH = self.PATH_INT + "/2" int_data["configuration"]["name"] = "2" # Setup patch int_data["configuration"]["user_config"] = {} int_data["configuration"]["user_config"]["duplex"] = "half" int_data["configuration"]["user_config"]["autoneg"] = "off" int_data["configuration"]["user_config"]["pause"] = "rxtx" # Patch info("\n########## Test to Validate Patch Other ##########\n") status_code, response_data = execute_request( self.INT_PATH, "PATCH", json.dumps(OTHER_PATCH), self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.NO_CONTENT, "Error patching an "\ "Interface. Status code: %s Response data: %s "\ % (status_code, response_data) info("### Interface Patched. Status code is 204 NO CONTENT ###\n") # Verify data status_code, response_data = execute_request( self.INT_PATH, "GET", None, self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.OK, "Failed to query patched Port" json_data = get_json(response_data) assert json_data["configuration"] == int_data["configuration"],\ "Configuration data is not equal that posted data" info("### Configuration data validated ###\n") # Remove data int_data = copy.deepcopy(INT_DATA) int_data["configuration"]["name"] = "2" status_code, response_data = execute_request( self.INT_PATH, "PATCH", json.dumps(REMOVE_PATCH), self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.NO_CONTENT, "Error patching an "\ "Interface. Status code: %s Response data: %s "\ % (status_code, response_data) info("### Interface Patched. Status code is 204 NO CONTENT ###\n") # Verify data status_code, response_data = execute_request( self.INT_PATH, "GET", None, self.SWITCH_IP, False, xtra_header=self.cookie_header) assert status_code == httplib.OK, "Failed to query patched Port" json_data = get_json(response_data) assert json_data["configuration"] == int_data["configuration"],\ "Configuration data is not equal that posted data" info("### Configuration data validated ###\n") info("\n########## End Test Create And Patch Port Int ##########\n")