77fa57cca99c613695d0d7744b91b9f3878b02ba
[osm/SO.git] / rwlaunchpad / plugins / rwnsm / rift / tasklets / rwnsmtasklet / rwnsmplugin.py
1 #
2 # Copyright 2016 RIFT.IO Inc
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16
17 import asyncio
18 import abc
19
20
21 class NsmPluginBase(object):
22 """
23 Abstract base class for the NSM plugin.
24 There will be single instance of this plugin for each plugin type.
25 """
26
27 def __init__(self, dts, log, loop, nsm, plugin_name, dts_publisher):
28 self._dts = dts
29 self._log = log
30 self._loop = loop
31 self._nsm = nsm
32 self._plugin_name = plugin_name
33 self._dts_publisher = dts_publisher
34
35 @property
36 def dts(self):
37 return self._dts
38
39 @property
40 def log(self):
41 return self._log
42
43 @property
44 def loop(self):
45 return self._loop
46
47 @property
48 def nsm(self):
49 return self._nsm
50
51 @abc.abstractmethod
52 def set_state(self, nsr_id, state):
53 pass
54
55 @abc.abstractmethod
56 def create_nsr(self, nsr):
57 """ Create an NSR """
58 pass
59
60 @abc.abstractmethod
61 @asyncio.coroutine
62 def deploy(self, nsr_msg):
63 pass
64
65 @abc.abstractmethod
66 @asyncio.coroutine
67 def instantiate_ns(self, nsr, xact):
68 """ Instantiate the network service """
69 pass
70
71 @abc.abstractmethod
72 @asyncio.coroutine
73 def instantiate_vnf(self, nsr, vnfr):
74 """ Instantiate the virtual network function """
75 pass
76
77 @abc.abstractmethod
78 @asyncio.coroutine
79 def instantiate_vl(self, nsr, vl):
80 """ Instantiate the virtual link"""
81 pass
82
83 @abc.abstractmethod
84 @asyncio.coroutine
85 def get_nsr(self, nsr_path):
86 """ Get the NSR """
87 pass
88
89 @abc.abstractmethod
90 @asyncio.coroutine
91 def get_vnfr(self, vnfr_path):
92 """ Get the VNFR """
93 pass
94
95 @abc.abstractmethod
96 @asyncio.coroutine
97 def get_vlr(self, vlr_path):
98 """ Get the VLR """
99 pass
100
101 @abc.abstractmethod
102 @asyncio.coroutine
103 def terminate_ns(self, nsr):
104 """Terminate the network service """
105 pass
106
107 @abc.abstractmethod
108 @asyncio.coroutine
109 def terminate_vnf(self, vnfr):
110 """Terminate the VNF """
111 pass
112
113 @abc.abstractmethod
114 @asyncio.coroutine
115 def terminate_vl(self, vlr):
116 """Terminate the Virtual Link Record"""
117 pass