projects
/
osm
/
SO.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
68a86bf
)
Bug 154 Fix terminate VL during terminate NS
78/978/1
author
Philip Joseph
<philip.joseph@riftio.com>
Wed, 18 Jan 2017 12:00:40 +0000
(17:30 +0530)
committer
Philip Joseph
<philip.joseph@riftio.com>
Wed, 18 Jan 2017 12:00:40 +0000
(17:30 +0530)
Signed-off-by: Philip Joseph <philip.joseph@riftio.com>
rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/cloud.py
patch
|
blob
|
history
rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/openmano_nsm.py
patch
|
blob
|
history
rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/rwnsmplugin.py
patch
|
blob
|
history
rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/rwnsmtasklet.py
patch
|
blob
|
history
diff --git
a/rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/cloud.py
b/rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/cloud.py
index
32efff2
..
007e62c
100644
(file)
--- a/
rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/cloud.py
+++ b/
rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/cloud.py
@@
-40,6
+40,9
@@
class RwNsPlugin(rwnsmplugin.NsmPluginBase):
self._log = log
self._loop = loop
self._log = log
self._loop = loop
+ def set_state(self, nsr_id, state):
+ pass
+
def create_nsr(self, nsr_msg, nsd,key_pairs=None):
"""
Create Network service record
def create_nsr(self, nsr_msg, nsd,key_pairs=None):
"""
Create Network service record
diff --git
a/rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/openmano_nsm.py
b/rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/openmano_nsm.py
index
6c18946
..
e009ba3
100644
(file)
--- a/
rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/openmano_nsm.py
+++ b/
rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/openmano_nsm.py
@@
-244,17
+244,18
@@
class OpenmanoVnfr(object):
class OpenmanoNSRecordState(Enum):
""" Network Service Record State """
class OpenmanoNSRecordState(Enum):
""" Network Service Record State """
+ # Make sure the values match with NetworkServiceRecordState
INIT = 101
INSTANTIATION_PENDING = 102
INIT = 101
INSTANTIATION_PENDING = 102
- RUNNING = 10
3
- SCALING_OUT = 10
4
- SCALING_IN = 10
5
- TERMINATE = 10
6
- TERMINATE_RCVD = 1
07
- TERMINATED = 1
08
- FAILED = 1
09
- VL_INSTANTIATE = 11
0
- VL_TERMINATE = 11
1
+ RUNNING = 10
6
+ SCALING_OUT = 10
7
+ SCALING_IN = 10
8
+ TERMINATE = 10
9
+ TERMINATE_RCVD = 1
10
+ TERMINATED = 1
14
+ FAILED = 1
15
+ VL_INSTANTIATE = 11
6
+ VL_TERMINATE = 11
7
class OpenmanoNsr(object):
class OpenmanoNsr(object):
@@
-421,6
+422,13
@@
class OpenmanoNsr(object):
@asyncio.coroutine
def remove_vlr(self, vlr):
@asyncio.coroutine
def remove_vlr(self, vlr):
+ if vlr in self._vlrs:
+ self._vlrs.remove(vlr)
+ yield from self._publisher.unpublish_vlr(None, vlr.vlr_msg)
+ yield from asyncio.sleep(1, loop=self._loop)
+
+ @asyncio.coroutine
+ def delete_vlr(self, vlr):
if vlr in self._vlrs:
self._vlrs.remove(vlr)
if not vlr.vld_msg.vim_network_name:
if vlr in self._vlrs:
self._vlrs.remove(vlr)
if not vlr.vld_msg.vim_network_name:
@@
-815,6
+823,15
@@
class OpenmanoNsPlugin(rwnsmplugin.NsmPluginBase):
ro_account.openmano.tenant_id,
)
ro_account.openmano.tenant_id,
)
+ def set_state(self, nsr_id, state):
+ # Currently we update only during terminate to
+ # decide how to handle VL terminate
+ if state.value == OpenmanoNSRecordState.TERMINATE.value:
+ self._openmano_nsrs[nsr_id]._state = \
+ [member.value for name, member in \
+ OpenmanoNSRecordState.__members__.items() \
+ if member.value == state.value]
+
def create_nsr(self, nsr_config_msg, nsd_msg, key_pairs=None):
"""
Create Network service record
def create_nsr(self, nsr_config_msg, nsd_msg, key_pairs=None):
"""
Create Network service record
@@
-920,6
+937,7
@@
class OpenmanoNsPlugin(rwnsmplugin.NsmPluginBase):
"""
self._log.debug("Received terminate VL for VLR {}".format(vlr))
openmano_nsr = self._openmano_nsrs[vlr._nsr_id]
"""
self._log.debug("Received terminate VL for VLR {}".format(vlr))
openmano_nsr = self._openmano_nsrs[vlr._nsr_id]
- yield from openmano_nsr.remove_vlr(vlr)
-
-
+ if openmano_nsr._state == OpenmanoNSRecordState.RUNNING:
+ yield from openmano_nsr.delete_vlr(vlr)
+ else:
+ yield from openmano_nsr.remove_vlr(vlr)
diff --git
a/rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/rwnsmplugin.py
b/rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/rwnsmplugin.py
index
ec16259
..
77fa57c
100755
(executable)
--- a/
rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/rwnsmplugin.py
+++ b/
rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/rwnsmplugin.py
@@
-48,6
+48,11
@@
class NsmPluginBase(object):
def nsm(self):
return self._nsm
def nsm(self):
return self._nsm
+ @abc.abstractmethod
+ def set_state(self, nsr_id, state):
+ pass
+
+ @abc.abstractmethod
def create_nsr(self, nsr):
""" Create an NSR """
pass
def create_nsr(self, nsr):
""" Create an NSR """
pass
diff --git
a/rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/rwnsmtasklet.py
b/rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/rwnsmtasklet.py
index
0537cc5
..
3153a48
100755
(executable)
--- a/
rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/rwnsmtasklet.py
+++ b/
rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/rwnsmtasklet.py
@@
-1296,6
+1296,7
@@
class NetworkServiceRecord(object):
self._vnf_phase_completed = True
self._op_status.set_state(state)
self._vnf_phase_completed = True
self._op_status.set_state(state)
+ self._nsm_plugin.set_state(self.id, state)
@property
def id(self):
@property
def id(self):