Skip to content

Commit 8ddba21

Browse files
author
bgotura
committed
First push from UoB Repository
1 parent 074b94e commit 8ddba21

File tree

19 files changed

+4424
-0
lines changed

19 files changed

+4424
-0
lines changed

proxy/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
# Copyright 2017-2022 Univertity of Bristol - High Performance Networks Group
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.

proxy/conf/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright 2019-2024 Rafael S. Guimaraes, Univertity of Bristol
2+
# High Performance Networks Group
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#!/usr/bin/python3
145 Bytes
Binary file not shown.
1.43 KB
Binary file not shown.

proxy/conf/config.py

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
# Copyright 2017-2022 Univertity of Bristol - High Performance Networks Group
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+
# Topology of Ruckus Controller
18+
RUCKUS_INIT_TOPOLOGY = {
19+
"boxes": [
20+
{
21+
"id": 10,
22+
"name": "ruckus-east-roof",
23+
"location": {
24+
"longitude": -2.597035,
25+
"latitude": 51.448181,
26+
"info": "ruckus-east-roof"
27+
},
28+
"phys": [
29+
{
30+
"id": 11,
31+
"name": "eth0",
32+
"type": "WIRED_TUNNEL",
33+
"config": None
34+
},
35+
{
36+
"id": 12,
37+
"name": "phy0",
38+
"type": "SUB6_ACCESS",
39+
"config": None
40+
}]
41+
},
42+
{
43+
"id": 20,
44+
"name": "ruckus-middle-roof",
45+
"location": {
46+
"longitude": -2.598227,
47+
"latitude": 51.447858,
48+
"info": "ruckus-middle-roof"
49+
},
50+
"phys": [
51+
{
52+
"id": 21,
53+
"name": "eth0",
54+
"type": "WIRED_TUNNEL",
55+
"config": None
56+
},
57+
{
58+
"id": 22,
59+
"name": "phy0",
60+
"type": "SUB6_ACCESS",
61+
"config": None
62+
}]
63+
}, {
64+
"id": 30,
65+
"name": "ruckus-west-roof",
66+
"location": {
67+
"longitude": -2.599009,
68+
"latitude": 51.447500,
69+
"info": "ruckus-west-roof"
70+
},
71+
"phys": [
72+
{
73+
"id": 31,
74+
"name": "eth0",
75+
"type": "WIRED_TUNNEL",
76+
"config": None
77+
},
78+
{
79+
"id": 32,
80+
"name": "phy0",
81+
"type": "SUB6_ACCESS",
82+
"config": None
83+
}]
84+
}
85+
],
86+
"links": []
87+
}
88+
89+
# Mapping between AP ids in Ruckus and AP ids in topology
90+
RUCKUS_ID_MAPPING = {
91+
"zone_id": "f77a8816-3049-40cd-8484-82919275ddc3",
92+
11: {
93+
"zone_id": "f77a8816-3049-40cd-8484-82919275ddc3",
94+
"apgroup_id": "68b00bbb-f400-462d-b4f4-3e9160013155",
95+
"wlangroup_id": "bd690a30-bab7-11e9-91f9-22d1e8e61ae8",
96+
"type": "WIRED_TUNNEL"
97+
},
98+
12: {
99+
"zone_id": "f77a8816-3049-40cd-8484-82919275ddc3",
100+
"apgroup_id": "68b00bbb-f400-462d-b4f4-3e9160013155",
101+
"wlangroup_id": "bd690a30-bab7-11e9-91f9-22d1e8e61ae8",
102+
"type": "2.4GHZ"
103+
},
104+
21: {
105+
"zone_id": "f77a8816-3049-40cd-8484-82919275ddc3",
106+
"apgroup_id": "6c9ee78e-0928-4526-b461-2ca45acf769b",
107+
"wlangroup_id": "ca8beca2-bab7-11e9-91f9-22d1e8e61ae8",
108+
"type": "WIRED_TUNNEL"
109+
},
110+
22: {
111+
"zone_id": "f77a8816-3049-40cd-8484-82919275ddc3",
112+
"apgroup_id": "6c9ee78e-0928-4526-b461-2ca45acf769b",
113+
"wlangroup_id": "ca8beca2-bab7-11e9-91f9-22d1e8e61ae8",
114+
"type": "2.4GHZ"
115+
},
116+
31: {
117+
"zone_id": "f77a8816-3049-40cd-8484-82919275ddc3",
118+
"apgroup_id": "5aa9383e-ca82-41da-bb4f-e804f48de9bf",
119+
"wlangroup_id": "a631da42-771e-11e9-91f9-22d1e8e61ae8",
120+
"type": "WIRED_TUNNEL"
121+
},
122+
32: {
123+
"zone_id": "f77a8816-3049-40cd-8484-82919275ddc3",
124+
"apgroup_id": "5aa9383e-ca82-41da-bb4f-e804f48de9bf",
125+
"wlangroup_id": "a631da42-771e-11e9-91f9-22d1e8e61ae8",
126+
"type": "2.4GHZ"
127+
}
128+
}
129+
130+
# Controller Id's need to match the position in the list
131+
CONTROLLERS = [
132+
{
133+
'id': 0,
134+
'type': 'ruckus',
135+
'ip': '10.68.20.250',
136+
'port': 8443,
137+
'url': 'https://{}:{}/wsg/api/public',
138+
'topology': RUCKUS_INIT_TOPOLOGY,
139+
'username': 'admin',
140+
'password': <PASSWORD>
141+
},
142+
{
143+
'id': 1,
144+
'type': 'i2cat',
145+
'ip': '10.68.34.16',
146+
'port': 8008,
147+
'url': 'http://{}:{}'
148+
}
149+
]

proxy/lib/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
# Copyright 2017-2022 Univertity of Bristol - High Performance Networks Group
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.
144 Bytes
Binary file not shown.
5.61 KB
Binary file not shown.
7.78 KB
Binary file not shown.

proxy/lib/adapters/i2cat.py

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
# Copyright 2017-2022 Univertity of Bristol - High Performance Networks Group
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+
import json
17+
import requests
18+
19+
_headers = {
20+
'Content-type': 'application/json',
21+
"Accept": "application/json",
22+
'Cache-Control': 'no-cache'
23+
}
24+
25+
class I2catController(object):
26+
"""Integration with FlexRAN solution
27+
28+
Arguments:
29+
Wireless {[type]} -- [description]
30+
"""
31+
def __init__(self,
32+
controller_id=None,
33+
ip='127.0.0.1',
34+
port=8080,
35+
url=None):
36+
self.id = controller_id
37+
self._ip = ip
38+
self._port = port
39+
self._url = url.format(ip,port)
40+
41+
42+
# chunkete-topology-controller implementation
43+
def getChunketeTopology(self):
44+
url = (self._url + "/chunkete/topology").format(self._ip, str(self._port))
45+
46+
resp = requests.get(url)
47+
data = json.loads(resp.text)
48+
return data, resp.status_code
49+
50+
def putInterfaceLTEConfig(self, phy_id, parameters):
51+
url = self._url + \
52+
"/chunkete/topology/physicalInterface/{}/LTEConfig".format(
53+
phy_id)
54+
resp = requests.put(
55+
url,
56+
data=parameters,
57+
headers=_headers
58+
)
59+
data = json.loads(resp.text)
60+
return data, resp.status_code
61+
62+
def putInterfaceType(self, phy_id, phy_type):
63+
url = "http://{}:{}/chunkete/topology/physicalInterface/{}/type/{}".format(
64+
self._ip, str(self._port), phy_id, phy_type)
65+
resp = requests.put(
66+
url,
67+
headers=_headers
68+
)
69+
data = json.loads(resp.text)
70+
return data, resp.status_code
71+
72+
def putInterfaceWiredConfig(self, phy_id, parameters):
73+
url = "http://{}:{}/chunkete/topology/physicalInterface/{}/wiredConfig".format(
74+
self._ip, str(self._port), phy_id)
75+
resp = requests.put(
76+
url,
77+
data=parameters,
78+
headers=_headers
79+
)
80+
data = json.loads(resp.text)
81+
return data, resp.status_code
82+
83+
def putInterfaceWirelessConfig(self, phy_id, parameters):
84+
url = self._url + "/chunkete/topology/physicalInterface/{}/wirelessConfig".format(
85+
phy_id)
86+
resp = requests.put(
87+
url,
88+
data=parameters,
89+
headers=_headers
90+
)
91+
data = json.loads(resp.text)
92+
return data, resp.status_code
93+
94+
95+
# chunkete-chunk-controller implementation
96+
def getAllChunks(self):
97+
url = "http://{}:{}/chunkete/chunk".format(
98+
self._ip,
99+
str(self._port))
100+
101+
resp = requests.get(url)
102+
data = json.loads(resp.text)
103+
return data, resp.status_code
104+
105+
def registerNewChunk(self, content):
106+
pre_chunk_list, code = self.getAllChunks()
107+
pre_chunk_ids = [x["id"] for x in pre_chunk_list]
108+
109+
url = "http://{}:{}/chunkete/chunk".format(
110+
self._ip, str(self._port))
111+
resp = requests.post(
112+
url,
113+
data=content,
114+
headers=_headers
115+
)
116+
117+
post_chunk_list, code = self.getAllChunks()
118+
post_chunk_ids = [x["id"] for x in post_chunk_list]
119+
120+
chunk_id = [x for x in post_chunk_ids if x not in pre_chunk_ids][0]
121+
122+
data = json.loads(resp.text)
123+
return data, resp.status_code
124+
125+
def getChunkById(self, chunk_id):
126+
url = "http://{}:{}/chunkete/chunk/{}".format(
127+
self._ip, str(self._port), chunk_id)
128+
resp = requests.get(
129+
url,
130+
headers=_headers
131+
)
132+
data = json.loads(resp.text)
133+
return data, resp.status_code
134+
135+
def removeExistingChunk(self, chunk_id):
136+
url = "http://{}:{}/chunkete/chunk/{}".format(
137+
self._ip, str(self._port), chunk_id)
138+
resp = requests.delete(
139+
url,
140+
headers=_headers
141+
)
142+
if resp.status_code == 200:
143+
data = resp.text
144+
else:
145+
data = json.loads(resp.text)
146+
return data, resp.status_code
147+
148+
149+
# chunkete-swam-controller implementation
150+
def getAllSWAMServices(self, chunk_id):
151+
url = "http://{}:{}/chunkete/chunk/{}/service/SWAM".format(
152+
self._ip, str(self._port), chunk_id)
153+
resp = requests.get(
154+
url,
155+
headers=_headers
156+
)
157+
data = json.loads(resp.text)
158+
return data, resp.status_code
159+
160+
def registerNewSWAMService(self, chunk_id, content):
161+
url = "http://{}:{}/chunkete/chunk/{}/service/SWAM".format(
162+
self._ip, str(self._port), chunk_id)
163+
resp = requests.post(
164+
url,
165+
data=content,
166+
headers=_headers
167+
)
168+
data = json.loads(resp.text)
169+
return data, resp.status_code
170+
171+
def getSWAMServiceById(self, chunk_id, service_id):
172+
url = "http://{}:{}/chunkete/chunk/{}/service/SWAM/{}".format(
173+
self._ip, str(self._port), chunk_id, service_id)
174+
resp = requests.get(
175+
url,
176+
headers=_headers
177+
)
178+
data = json.loads(resp.text)
179+
return data, resp.status_code
180+
181+
def removeExistingSWAMService(self, chunk_id, service_id):
182+
url = "http://{}:{}/chunkete/chunk/{}/service/SWAM/{}".format(
183+
self._ip, str(self._port), chunk_id, service_id)
184+
resp = requests.delete(
185+
url,
186+
headers=_headers
187+
)
188+
if resp.text:
189+
data = json.loads(resp.text)
190+
else:
191+
data = ''
192+
return data, resp.status_code

0 commit comments

Comments
 (0)