- def create(self, name, sdn_controller):
- resp = self._http.post_cmd(endpoint=self._apiBase,
+
+ # SDNC '--wait' option
+ def _wait(self, id, deleteFlag=False):
+ # Endpoint to get operation status
+ apiUrlStatus = '{}{}{}'.format(self._apiName, self._apiVersion, '/sdns')
+ # Wait for status for SDN instance creation/update/deletion
+ WaitForStatus.wait_for_status(
+ 'SDNC',
+ str(id),
+ WaitForStatus.TIMEOUT_SDNC_OPERATION,
+ apiUrlStatus,
+ self._http.get2_cmd,
+ deleteFlag=deleteFlag)
+
+ def _get_id_for_wait(self, name):
+ # Returns id of name, or the id itself if given as argument
+ for sdnc in self.list():
+ if name == sdnc['_id']:
+ return sdnc['_id']
+ for sdnc in self.list():
+ if name == sdnc['name']:
+ return sdnc['_id']
+ return ''
+
+ def create(self, name, sdn_controller, wait=False):
+ http_code, resp = self._http.post_cmd(endpoint=self._apiBase,