Skip to content

Commit

Permalink
Updates with new parameters from plugin changes (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
hemanthKa677 authored May 8, 2023
1 parent 557c091 commit 59b8b03
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# NIOS test container

A simple flask application to simulate the v2.1 NIOS REST api.
A simple flask application to simulate the v2.9 NIOS REST api.
25 changes: 18 additions & 7 deletions flaskapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ class NetworkView(object):
forwarding_servers = []
external_servers = []
stub_members = []
members = []
master_candidate = False
start_addr = None
end_addr = None
member = None

def __init__(self, uid=None, isdefault=False, name=None, viewtype='network', network=None, comment=None):
# `ZG5zLm5ldHdvcmskMS4wLjAuMC8yNC8w` == `dns.network$1.0.0.0/24/0`
Expand Down Expand Up @@ -153,7 +158,7 @@ def _refid(self):
@property
def _ref(self):
'''
(ansidev) jtanner-OSX:AP-NIOS_FLASK_MOCK jtanner$ curl -k -u admin:infoblox 'https://192.168.10.10/wapi/v2.1/network'
(ansidev) jtanner-OSX:AP-NIOS_FLASK_MOCK jtanner$ curl -k -u admin:infoblox 'https://192.168.10.10/wapi/v2.9/network'
[
{
"_ref": "network/ZG5zLm5ldHdvcmskMS4wLjAuMC8yNC8w:1.0.0.0/24/default",
Expand All @@ -166,7 +171,7 @@ def _ref(self):
"network_view": "ansible-view"
}
]
(ansidev) jtanner-OSX:AP-NIOS_FLASK_MOCK jtanner$ curl -k -u admin:infoblox 'https://192.168.10.10/wapi/v2.1/ipv6network'
(ansidev) jtanner-OSX:AP-NIOS_FLASK_MOCK jtanner$ curl -k -u admin:infoblox 'https://192.168.10.10/wapi/v2.9/ipv6network'
[
{
"_ref": "ipv6network/ZG5zLm5ldHdvcmskZmU4MDo6LzY0LzA:fe80%3A%3A/64/default",
Expand Down Expand Up @@ -239,6 +244,11 @@ def to_dict(self, fields=[]):
'forwarding_servers': self.forwarding_servers,
'external_servers': self.external_servers,
'stub_members': self.stub_members,
'members': self.members,
'master_candidate': self.master_candidate,
'start_addr': self.start_addr,
'end_addr': self.end_addr,
'member': self.member,
}
if fields:
for x in fields:
Expand Down Expand Up @@ -279,6 +289,7 @@ def __init__(self):
'nsgroup:forwardingmember': [],
'nsgroup:forwardstubserver': [],
'nsgroup:stubmember': [],
'range': [],
}
# ZG5zLm5ldHdvcmtfdmlldyQw == dns.network_view$0
# ZG5zLm5ldHdvcmskZmU4MDo6LzY0LzA == dns.network$fe80::/64
Expand Down Expand Up @@ -445,7 +456,7 @@ def serialize_view_by_refid(self, refid, returnfields=[]):
DATA = DataModel()


@app.route('/wapi/v2.1/<viewtype>', methods=['GET', 'POST', 'PUT', 'DELETE'])
@app.route('/wapi/v2.9/<viewtype>', methods=['GET', 'POST', 'PUT', 'DELETE'])
def v21_base(viewtype):
#if viewtype != 'view':
# viewtype = viewtype.replace('view', '')
Expand Down Expand Up @@ -483,10 +494,10 @@ def v21_base(viewtype):

return jsonify({})

# /wapi/v2.1/network/bmV0d29yayQxLjAuMC4wLzI0JGRlZmF1bHQ%3D%3A1.0.0.0/24/default
#@app.route('/wapi/v2.1/<viewtype>/<refid>/<subname>', methods=['GET', 'POST', 'PUT', 'DELETE'])
#@app.route('/wapi/v2.1/<viewtype>/<refid>/<subname>/subsubname', methods=['GET', 'POST', 'PUT', 'DELETE'])
@app.route('/wapi/v2.1/<viewtype>/<path:refpath>', methods=['GET', 'POST', 'PUT', 'DELETE'])
# /wapi/v2.9/network/bmV0d29yayQxLjAuMC4wLzI0JGRlZmF1bHQ%3D%3A1.0.0.0/24/default
# @app.route('/wapi/v2.9/<viewtype>/<refid>/<subname>', methods=['GET', 'POST', 'PUT', 'DELETE'])
# @app.route('/wapi/v2.9/<viewtype>/<refid>/<subname>/subsubname', methods=['GET', 'POST', 'PUT', 'DELETE'])
@app.route('/wapi/v2.9/<viewtype>/<path:refpath>', methods=['GET', 'POST', 'PUT', 'DELETE'])
def v21_abstractview_ref(viewtype, refid=None, subname=None, refpath=None, subsubname=None):

'''
Expand Down

0 comments on commit 59b8b03

Please sign in to comment.