diff options
author | hongyuzhao <zhao.hongyu@zte.com.cn> | 2019-12-19 15:16:02 +0800 |
---|---|---|
committer | hongyuzhao <zhao.hongyu@zte.com.cn> | 2020-01-04 11:31:14 +0800 |
commit | 5464ccb452d84a89ed70e056439c73cd7da0e31d (patch) | |
tree | 2213b7a8e1db539c65584854fc286734706a0209 /lcm/lcm/nf/biz/create_subscription.py | |
parent | 3ee9298ba721307c226d0f9af8d36a1dc982d226 (diff) |
Fix bug for deleting subscription in ns termination
Change-Id: I47bb40a5275c36c189cf6f8bf57a1bf6ec1f84b5
Issue-ID: VFC-1594
Signed-off-by: hongyuzhao <zhao.hongyu@zte.com.cn>
Diffstat (limited to 'lcm/lcm/nf/biz/create_subscription.py')
-rw-r--r-- | lcm/lcm/nf/biz/create_subscription.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lcm/lcm/nf/biz/create_subscription.py b/lcm/lcm/nf/biz/create_subscription.py index 2b1f6064..5f981d0a 100644 --- a/lcm/lcm/nf/biz/create_subscription.py +++ b/lcm/lcm/nf/biz/create_subscription.py @@ -53,14 +53,15 @@ class CreateSubscription: def check_callbackuri_connection(self): logger.debug("SubscribeNotification-post::> Sending GET request " "to %s" % self.callback_uri) - try: - response = requests.get(self.callback_uri, timeout=2) - if response.status_code != status.HTTP_204_NO_CONTENT: - raise NFLCMException("callbackUri %s returns %s status " - "code." % (self.callback_uri, response.status_code)) - except Exception: - raise NFLCMException("callbackUri %s didn't return 204 status" - "code." % self.callback_uri) + retry_count = 3 + while retry_count > 0: + response = requests.get(self.callback_uri, timeout=10) + if response.status_code == status.HTTP_204_NO_CONTENT: + return + logger.debug("callbackUri %s returns %s status code." % (self.callback_uri, response.status_code)) + retry_count = - 1 + + raise NFLCMException("callbackUri %s didn't return 204 status." % self.callback_uri) def do_biz(self): self.subscription_id = str(uuid.uuid4()) |