-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
110 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,69 @@ | ||
from service_mapping_plugin_framework.deallocate_nssi_abc import DeallocateNSSIabc | ||
import requests | ||
import json | ||
|
||
|
||
class NFVOPlugin(DeallocateNSSIabc): | ||
def __init__(self, nm_host, nfvo_host): | ||
super().__init__(nm_host, nfvo_host) | ||
def __init__(self, nm_host, nfvo_host, subscription_host, parameter): | ||
super().__init__(nm_host, nfvo_host, subscription_host, parameter) | ||
self.headers = {'Content-type': 'application/json'} | ||
|
||
def coordinate_tn_manager(self): | ||
pass | ||
|
||
def terminate_network_service_instance(self): | ||
pass | ||
print('Terminate Network service instance...') | ||
url = self.NFVO_URL + "nslcm/v1/ns_instances/{}/terminate/".format(self.ns_instance) | ||
response = requests.post(url, headers=self.headers) | ||
print(response.status_code) | ||
|
||
def delete_network_service_instance(self): | ||
print('Delete Network service instance...') | ||
url = self.NFVO_URL + "nslcm/v1/ns_instances/{}/".format(self.ns_instance) | ||
response = requests.delete(url, headers=self.headers) | ||
print(response.status_code) | ||
|
||
def delete_network_service_instance_subscriptions(self): | ||
pass | ||
|
||
def update_network_service_descriptor(self): | ||
pass | ||
print('Update Network service descriptor...') | ||
url = self.NFVO_URL + "nsd/v1/ns_descriptors/{}/".format(self.ns_descriptor) | ||
data = { | ||
"nsdOperationalState": "DISABLED", | ||
"userDefinedData": [ | ||
{} | ||
] | ||
} | ||
response = requests.patch(url, data=json.dumps(data), headers=self.headers) | ||
print(response.status_code) | ||
|
||
def delete_network_service_descriptor(self): | ||
print('Delete Network service descriptor...') | ||
url = self.NFVO_URL + "nsd/v1/ns_descriptors/{}/".format(self.ns_descriptor) | ||
response = requests.delete(url, headers=self.headers) | ||
print(response.status_code) | ||
|
||
def delete_network_service_descriptor_subscriptions(self): | ||
pass | ||
|
||
def update_vnf_package(self): | ||
pass | ||
for vnf in self.vnf_package: | ||
print('Update {} Vnf Package...'.format(vnf)) | ||
url = self.NFVO_URL + "vnfpkgm/v1/vnf_packages/{}/".format(vnf) | ||
data = { | ||
"operationalState": "DISABLED", | ||
"userDefinedData": {} | ||
} | ||
response = requests.patch(url, data=json.dumps(data), headers=self.headers) | ||
print(response.status_code) | ||
|
||
def delete_vnf_package(self): | ||
pass | ||
|
||
|
||
def main(): | ||
nfvo_plugin = NFVOPlugin('', # nm host ip | ||
'') # os-ma-nfvo host ip | ||
nfvo_plugin.deallocate_nssi() | ||
for vnf in self.vnf_package: | ||
print('Delete {} Vnf Package...'.format(vnf)) | ||
url = self.NFVO_URL + "vnfpkgm/v1/vnf_packages/{}/".format(vnf) | ||
response = requests.delete(url, headers=self.headers) | ||
print(response.status_code) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() | ||
def delete_vnf_package_subscriptions(self): | ||
pass |