Loading services/TS29222_CAPIF_Publish_Service_API/published_apis/core/serviceapidescriptions.py +12 −11 Original line number Diff line number Diff line Loading @@ -312,11 +312,11 @@ class PublishServiceOperations(Resource): return 'https://{}/published-apis/v1/{}/service-apis'.format(dom, config['ccf_id']) def find_shared_service_api_id(self, dom, api_name, cause): """Resolve the api_id a peer CCF assigned to its copy of a service API. """Resolve the api_id a peer CCF assigned to its shared service API. A peer assigns its own api_id to the copy it stores and that id is never kept A peer assigns its own api_id to the API it stores and that id is never kept locally, so it is looked up by api_name out of the service APIs this CCF published there. Returns None when the peer holds no copy, plus an error response when the there. Returns None when the peer has not the specific API shared, plus an error response when the peer could not be asked. """ url = self.interconnection_service_apis_url(dom) Loading Loading @@ -393,7 +393,7 @@ class PublishServiceOperations(Resource): return unpublished_ccf_ids, internal_server_error( detail="Could not reach interconnected CCF {}".format(dom), cause=cause) # 404 means the peer already dropped its copy # 404 means the peer already dropped the specific API if response.status_code not in (204, 404): current_app.logger.error( "Interconnection: {} refused to unpublish service api {} with status {}".format( Loading @@ -409,7 +409,7 @@ class PublishServiceOperations(Resource): return unpublished_ccf_ids, None def update_on_interconnected_ccfs(self, shared_api_name, service_api, capif_prov_doms): """Push the current definition of a service API to the CCFs already holding a copy. """Push the current definition of a service API to the CCFs already holding the shared API. The copies are looked up under the name they were shared with, which is the one stored before this modification. Returns an error response if a peer could not be Loading Loading @@ -530,9 +530,9 @@ class PublishServiceOperations(Resource): "reached before the failure".format(api_name)) def reconcile_interconnection_sharing(self, service_api, old_service_api): """Align the interconnected CCFs holding a copy with the modification requested. """Align the interconnected CCFs holding the API with the modification requested. Domains dropped from the sharing list get the copy withdrawn, which covers every Domains dropped from the sharing list get the shared API withdrawn, which covers every domain at once when sharing is turned off. Domains added to it receive the service API, which covers every domain at once when sharing is turned on. Domains kept on the list get the copy they already hold updated. Returns the publication path to Loading @@ -550,7 +550,7 @@ class PublishServiceOperations(Resource): kept_doms = [dom for dom in new_doms if dom in old_doms] added_doms = [dom for dom in new_doms if dom not in old_doms] # Peers hold the copy under the name it carried when it was shared with them, so # Peers hold the sharedAPI under the name it carried when it was shared with them, so # a modification renaming the service API must still be matched against the old one shared_api_name = old_service_api.get("api_name") Loading Loading @@ -606,8 +606,9 @@ class PublishServiceOperations(Resource): detail="Service API not existing", cause="Service API id not found") # The copies held by interconnected CCFs go first, so that a peer that cannot # be reached leaves the service api published here instead of orphaned there # The shared APIs held by interconnected CCFs are removed first, so that when a peer cannot # be reached, the service api remains published both on source and target CCF # "_" contains the CCF ids where the API was successfully deleted _, interconnection_error = self.unpublish_from_interconnected_ccfs( serviceapidescription_dict.get("api_name"), shared_capif_prov_doms(serviceapidescription_dict.get("shareable_info"))) Loading Loading @@ -714,7 +715,7 @@ class PublishServiceOperations(Resource): invalid_params=[{"param": "apiStatus", "reason": "defined but apiStatusMoniroting feature not active"}] ) # The publication path records where the copies live, so this CCF owns it and # The publication path records where the CCFs holding the API live, so this CCF owns it and # the one held in the request is discarded service_api_description["pub_api_path"] = serviceapidescription_old.get("pub_api_path") Loading Loading
services/TS29222_CAPIF_Publish_Service_API/published_apis/core/serviceapidescriptions.py +12 −11 Original line number Diff line number Diff line Loading @@ -312,11 +312,11 @@ class PublishServiceOperations(Resource): return 'https://{}/published-apis/v1/{}/service-apis'.format(dom, config['ccf_id']) def find_shared_service_api_id(self, dom, api_name, cause): """Resolve the api_id a peer CCF assigned to its copy of a service API. """Resolve the api_id a peer CCF assigned to its shared service API. A peer assigns its own api_id to the copy it stores and that id is never kept A peer assigns its own api_id to the API it stores and that id is never kept locally, so it is looked up by api_name out of the service APIs this CCF published there. Returns None when the peer holds no copy, plus an error response when the there. Returns None when the peer has not the specific API shared, plus an error response when the peer could not be asked. """ url = self.interconnection_service_apis_url(dom) Loading Loading @@ -393,7 +393,7 @@ class PublishServiceOperations(Resource): return unpublished_ccf_ids, internal_server_error( detail="Could not reach interconnected CCF {}".format(dom), cause=cause) # 404 means the peer already dropped its copy # 404 means the peer already dropped the specific API if response.status_code not in (204, 404): current_app.logger.error( "Interconnection: {} refused to unpublish service api {} with status {}".format( Loading @@ -409,7 +409,7 @@ class PublishServiceOperations(Resource): return unpublished_ccf_ids, None def update_on_interconnected_ccfs(self, shared_api_name, service_api, capif_prov_doms): """Push the current definition of a service API to the CCFs already holding a copy. """Push the current definition of a service API to the CCFs already holding the shared API. The copies are looked up under the name they were shared with, which is the one stored before this modification. Returns an error response if a peer could not be Loading Loading @@ -530,9 +530,9 @@ class PublishServiceOperations(Resource): "reached before the failure".format(api_name)) def reconcile_interconnection_sharing(self, service_api, old_service_api): """Align the interconnected CCFs holding a copy with the modification requested. """Align the interconnected CCFs holding the API with the modification requested. Domains dropped from the sharing list get the copy withdrawn, which covers every Domains dropped from the sharing list get the shared API withdrawn, which covers every domain at once when sharing is turned off. Domains added to it receive the service API, which covers every domain at once when sharing is turned on. Domains kept on the list get the copy they already hold updated. Returns the publication path to Loading @@ -550,7 +550,7 @@ class PublishServiceOperations(Resource): kept_doms = [dom for dom in new_doms if dom in old_doms] added_doms = [dom for dom in new_doms if dom not in old_doms] # Peers hold the copy under the name it carried when it was shared with them, so # Peers hold the sharedAPI under the name it carried when it was shared with them, so # a modification renaming the service API must still be matched against the old one shared_api_name = old_service_api.get("api_name") Loading Loading @@ -606,8 +606,9 @@ class PublishServiceOperations(Resource): detail="Service API not existing", cause="Service API id not found") # The copies held by interconnected CCFs go first, so that a peer that cannot # be reached leaves the service api published here instead of orphaned there # The shared APIs held by interconnected CCFs are removed first, so that when a peer cannot # be reached, the service api remains published both on source and target CCF # "_" contains the CCF ids where the API was successfully deleted _, interconnection_error = self.unpublish_from_interconnected_ccfs( serviceapidescription_dict.get("api_name"), shared_capif_prov_doms(serviceapidescription_dict.get("shareable_info"))) Loading Loading @@ -714,7 +715,7 @@ class PublishServiceOperations(Resource): invalid_params=[{"param": "apiStatus", "reason": "defined but apiStatusMoniroting feature not active"}] ) # The publication path records where the copies live, so this CCF owns it and # The publication path records where the CCFs holding the API live, so this CCF owns it and # the one held in the request is discarded service_api_description["pub_api_path"] = serviceapidescription_old.get("pub_api_path") Loading