update from RIFT as of 696b75d2fe9fb046261b08c616f1bcf6c0b54a9b second try
[osm/SO.git] / rwlaunchpad / plugins / rwnsm / rift / tasklets / rwnsmtasklet / nsmpluginbase.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 class NsmPluginBase(object):
21 """
22 Abstract base class for the NSM plugin.
23 There will be single instance of this plugin for each plugin type.
24 """
25
26 def __init__(self, dts, log, loop, nsm, plugin_name, dts_publisher):
27 self._dts = dts
28 self._log = log
29 self._loop = loop
30 self._nsm = nsm
31 self._plugin_name = plugin_name
32 self._dts_publisher = dts_publisher
33
34 @property
35 def dts(self):
36 return self._dts
37
38 @property
39 def log(self):
40 return self._log
41
42 @property
43 def loop(self):
44 return self._loop
45
46 @property
47 def nsm(self):
48 return self._nsm
49
50 @abc.abstractmethod
51 def set_state(self, nsr_id, state):
52 pass
53
54 @abc.abstractmethod
55 def create_nsr(self, nsr, nsd, key_pairs=None, ssh_key=None):
56 """ Create an NSR """
57 pass
58
59 @abc.abstractmethod
60 @asyncio.coroutine
61 def deploy(self, nsr_msg):
62 pass
63
64 @abc.abstractmethod
65 @asyncio.coroutine
66 def instantiate_ns(self, nsr, xact):
67 """ Instantiate the network service """
68 pass
69
70 @abc.abstractmethod
71 @asyncio.coroutine
72 def instantiate_vnf(self, nsr, vnfr, scaleout=False):
73 """ Instantiate the virtual network function """
74 pass
75
76 @abc.abstractmethod
77 @asyncio.coroutine
78 def instantiate_vl(self, nsr, vl):
79 """ Instantiate the virtual link"""
80 pass
81
82 @abc.abstractmethod
83 @asyncio.coroutine
84 def update_vnfr(self, vnfr):
85 """ Update the virtual network function record """
86 pass
87
88 @abc.abstractmethod
89 @asyncio.coroutine
90 def get_nsr(self, nsr_path):
91 """ Get the NSR """
92 pass
93
94 @abc.abstractmethod
95 @asyncio.coroutine
96 def get_vnfr(self, vnfr_path):
97 """ Get the VNFR """
98 pass
99
100 @abc.abstractmethod
101 @asyncio.coroutine
102 def get_vlr(self, vlr_path):
103 """ Get the VLR """
104 pass
105
106 @abc.abstractmethod
107 @asyncio.coroutine
108 def terminate_ns(self, nsr):
109 """Terminate the network service """
110 pass
111
112 @abc.abstractmethod
113 @asyncio.coroutine
114 def terminate_vnf(self, nsr, vnfr, scalein=False):
115 """Terminate the VNF """
116 pass
117
118 @abc.abstractmethod
119 @asyncio.coroutine
120 def terminate_vl(self, vlr):
121 """Terminate the Virtual Link Record"""
122 pass