X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_lcm%2Fng_ro.py;h=9426488299ae63baaea685003df846697e2af87c;hb=8f6b0e74d6a2595ec8d7176e31ac729afd54f75b;hp=03819c850bd3b27e2f60875a2f2f4bb813f59f84;hpb=4ff4b51325ee03faf991cd0fd435658c9365ecf0;p=osm%2FLCM.git diff --git a/osm_lcm/ng_ro.py b/osm_lcm/ng_ro.py index 03819c8..9426488 100644 --- a/osm_lcm/ng_ro.py +++ b/osm_lcm/ng_ro.py @@ -67,8 +67,7 @@ class NgRoClient: timeout_large = 120 timeout_short = 30 - def __init__(self, loop, uri, **kwargs): - self.loop = loop + def __init__(self, uri, **kwargs): self.endpoint_url = uri if not self.endpoint_url.endswith("/"): self.endpoint_url += "/" @@ -103,7 +102,7 @@ class NgRoClient: payload_req = yaml.safe_dump(target) url = "{}/ns/v1/deploy/{nsr_id}".format(self.endpoint_url, nsr_id=nsr_id) - async with aiohttp.ClientSession(loop=self.loop) as session: + async with aiohttp.ClientSession() as session: self.logger.debug("NG-RO POST %s %s", url, payload_req) # timeout = aiohttp.ClientTimeout(total=self.timeout_large) async with session.post( @@ -136,7 +135,7 @@ class NgRoClient: payload_req = yaml.safe_dump(target) url = "{}/ns/v1/migrate/{nsr_id}".format(self.endpoint_url, nsr_id=nsr_id) - async with aiohttp.ClientSession(loop=self.loop) as session: + async with aiohttp.ClientSession() as session: self.logger.debug("NG-RO POST %s %s", url, payload_req) # timeout = aiohttp.ClientTimeout(total=self.timeout_large) async with session.post( @@ -172,7 +171,7 @@ class NgRoClient: url = "{}/ns/v1/{operation_type}/{nsr_id}".format( self.endpoint_url, operation_type=operation_type, nsr_id=nsr_id ) - async with aiohttp.ClientSession(loop=self.loop) as session: + async with aiohttp.ClientSession() as session: self.logger.debug("NG-RO POST %s %s", url, payload_req) # timeout = aiohttp.ClientTimeout(total=self.timeout_large) async with session.post( @@ -197,7 +196,7 @@ class NgRoClient: url = "{}/ns/v1/deploy/{nsr_id}/{action_id}".format( self.endpoint_url, nsr_id=nsr_id, action_id=action_id ) - async with aiohttp.ClientSession(loop=self.loop) as session: + async with aiohttp.ClientSession() as session: self.logger.debug("GET %s", url) # timeout = aiohttp.ClientTimeout(total=self.timeout_short) async with session.get(url, headers=self.headers_req) as response: @@ -219,7 +218,7 @@ class NgRoClient: async def delete(self, nsr_id): try: url = "{}/ns/v1/deploy/{nsr_id}".format(self.endpoint_url, nsr_id=nsr_id) - async with aiohttp.ClientSession(loop=self.loop) as session: + async with aiohttp.ClientSession() as session: self.logger.debug("DELETE %s", url) # timeout = aiohttp.ClientTimeout(total=self.timeout_short) async with session.delete(url, headers=self.headers_req) as response: @@ -242,7 +241,7 @@ class NgRoClient: """ try: response_text = "" - async with aiohttp.ClientSession(loop=self.loop) as session: + async with aiohttp.ClientSession() as session: url = "{}/version".format(self.endpoint_url) self.logger.debug("RO GET %s", url) # timeout = aiohttp.ClientTimeout(total=self.timeout_short) @@ -293,7 +292,7 @@ class NgRoClient: payload_req = yaml.safe_dump(target) url = "{}/ns/v1/recreate/{nsr_id}".format(self.endpoint_url, nsr_id=nsr_id) - async with aiohttp.ClientSession(loop=self.loop) as session: + async with aiohttp.ClientSession() as session: self.logger.debug("NG-RO POST %s %s", url, payload_req) async with session.post( url, headers=self.headers_req, data=payload_req @@ -317,7 +316,7 @@ class NgRoClient: url = "{}/ns/v1/recreate/{nsr_id}/{action_id}".format( self.endpoint_url, nsr_id=nsr_id, action_id=action_id ) - async with aiohttp.ClientSession(loop=self.loop) as session: + async with aiohttp.ClientSession() as session: self.logger.debug("GET %s", url) async with session.get(url, headers=self.headers_req) as response: response_text = await response.read() @@ -347,8 +346,10 @@ class NgRoClient: target = self._parse_yaml(target) payload_req = yaml.safe_dump(target) - url = "{}/ns/v1/verticalscale/{nsr_id}".format(self.endpoint_url, nsr_id=nsr_id) - async with aiohttp.ClientSession(loop=self.loop) as session: + url = "{}/ns/v1/verticalscale/{nsr_id}".format( + self.endpoint_url, nsr_id=nsr_id + ) + async with aiohttp.ClientSession() as session: self.logger.debug("NG-RO POST %s %s", url, payload_req) async with session.post( url, headers=self.headers_req, data=payload_req