Network RBAC rule management implemented.
Change-Id: Ia7f06b5e5c3fa7cef56173758d268c58e7f274f1
Related-Prod: SSMCP-149
diff --git a/_modules/neutronv2/__init__.py b/_modules/neutronv2/__init__.py
index 74b6fb1..c6ebe0f 100644
--- a/_modules/neutronv2/__init__.py
+++ b/_modules/neutronv2/__init__.py
@@ -14,6 +14,7 @@
from neutronv2 import routers
from neutronv2 import ports
from neutronv2 import common
+from neutronv2 import rbac
network_get_details = networks.network_get_details
@@ -69,6 +70,10 @@
port_get_details = ports.port_get_details
+rbac_policies_list = lists.rbac_policies_list
+rbac_policies_create = rbac.rbac_policies_create
+rbac_policies_delete = rbac.rbac_policies_delete
+
wait_for_network_services = agents.wait_for_network_services
wait_for_api_ready = common.wait_for_api_ready
@@ -88,6 +93,7 @@
'router_list', 'router_create', 'router_delete', 'router_get_details',
'router_interface_add', 'router_interface_remove', 'router_update',
'port_create', 'port_delete', 'port_update', 'port_list', 'port_get_details',
+ 'rbac_policies_create' 'rbac_policies_delete', 'rbac_policies_list',
)
diff --git a/_modules/neutronv2/lists.py b/_modules/neutronv2/lists.py
index eea4a7a..13958ee 100644
--- a/_modules/neutronv2/lists.py
+++ b/_modules/neutronv2/lists.py
@@ -39,4 +39,10 @@
@send('get')
def port_list(**kwargs):
url = '/ports?{}'.format(urlencode(kwargs))
- return url, {}
\ No newline at end of file
+ return url, {}
+
+
+@send('get')
+def rbac_policies_list(**kwargs):
+ url = '/rbac-policies?{}'.format(urlencode(kwargs))
+ return url, {}
diff --git a/_modules/neutronv2/rbac.py b/_modules/neutronv2/rbac.py
new file mode 100644
index 0000000..021d535
--- /dev/null
+++ b/_modules/neutronv2/rbac.py
@@ -0,0 +1,27 @@
+from neutronv2.common import send
+from neutronv2.arg_converter import get_by_name_or_uuid_multiple
+
+try:
+ from urllib.parse import urlencode
+except ImportError:
+ from urllib import urlencode
+
+
+@send('delete')
+def rbac_policies_delete(id):
+ url = '/rbac-policies/{}'.format(id)
+ return url, {}
+
+
+@get_by_name_or_uuid_multiple([('network', 'object_id')])
+@send('post')
+def rbac_policies_create(object_id,**kwargs):
+
+ url = '/rbac-policies'
+ kwargs.update({'object_type': 'network'})
+ kwargs.update({'object_id': object_id})
+ json = {
+ 'rbac_policy': kwargs,
+ }
+
+ return url, {'json': json}