Skip to content

Commit

Permalink
First push from UoB Repository
Browse files Browse the repository at this point in the history
  • Loading branch information
bgotura committed Sep 20, 2019
1 parent 074b94e commit 8ddba21
Show file tree
Hide file tree
Showing 19 changed files with 4,424 additions and 0 deletions.
14 changes: 14 additions & 0 deletions proxy/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2017-2022 Univertity of Bristol - High Performance Networks Group
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
14 changes: 14 additions & 0 deletions proxy/conf/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2019-2024 Rafael S. Guimaraes, Univertity of Bristol
# High Performance Networks Group
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#!/usr/bin/python3
Binary file added proxy/conf/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file added proxy/conf/__pycache__/config.cpython-37.pyc
Binary file not shown.
149 changes: 149 additions & 0 deletions proxy/conf/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2017-2022 Univertity of Bristol - High Performance Networks Group
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


# Topology of Ruckus Controller
RUCKUS_INIT_TOPOLOGY = {
"boxes": [
{
"id": 10,
"name": "ruckus-east-roof",
"location": {
"longitude": -2.597035,
"latitude": 51.448181,
"info": "ruckus-east-roof"
},
"phys": [
{
"id": 11,
"name": "eth0",
"type": "WIRED_TUNNEL",
"config": None
},
{
"id": 12,
"name": "phy0",
"type": "SUB6_ACCESS",
"config": None
}]
},
{
"id": 20,
"name": "ruckus-middle-roof",
"location": {
"longitude": -2.598227,
"latitude": 51.447858,
"info": "ruckus-middle-roof"
},
"phys": [
{
"id": 21,
"name": "eth0",
"type": "WIRED_TUNNEL",
"config": None
},
{
"id": 22,
"name": "phy0",
"type": "SUB6_ACCESS",
"config": None
}]
}, {
"id": 30,
"name": "ruckus-west-roof",
"location": {
"longitude": -2.599009,
"latitude": 51.447500,
"info": "ruckus-west-roof"
},
"phys": [
{
"id": 31,
"name": "eth0",
"type": "WIRED_TUNNEL",
"config": None
},
{
"id": 32,
"name": "phy0",
"type": "SUB6_ACCESS",
"config": None
}]
}
],
"links": []
}

# Mapping between AP ids in Ruckus and AP ids in topology
RUCKUS_ID_MAPPING = {
"zone_id": "f77a8816-3049-40cd-8484-82919275ddc3",
11: {
"zone_id": "f77a8816-3049-40cd-8484-82919275ddc3",
"apgroup_id": "68b00bbb-f400-462d-b4f4-3e9160013155",
"wlangroup_id": "bd690a30-bab7-11e9-91f9-22d1e8e61ae8",
"type": "WIRED_TUNNEL"
},
12: {
"zone_id": "f77a8816-3049-40cd-8484-82919275ddc3",
"apgroup_id": "68b00bbb-f400-462d-b4f4-3e9160013155",
"wlangroup_id": "bd690a30-bab7-11e9-91f9-22d1e8e61ae8",
"type": "2.4GHZ"
},
21: {
"zone_id": "f77a8816-3049-40cd-8484-82919275ddc3",
"apgroup_id": "6c9ee78e-0928-4526-b461-2ca45acf769b",
"wlangroup_id": "ca8beca2-bab7-11e9-91f9-22d1e8e61ae8",
"type": "WIRED_TUNNEL"
},
22: {
"zone_id": "f77a8816-3049-40cd-8484-82919275ddc3",
"apgroup_id": "6c9ee78e-0928-4526-b461-2ca45acf769b",
"wlangroup_id": "ca8beca2-bab7-11e9-91f9-22d1e8e61ae8",
"type": "2.4GHZ"
},
31: {
"zone_id": "f77a8816-3049-40cd-8484-82919275ddc3",
"apgroup_id": "5aa9383e-ca82-41da-bb4f-e804f48de9bf",
"wlangroup_id": "a631da42-771e-11e9-91f9-22d1e8e61ae8",
"type": "WIRED_TUNNEL"
},
32: {
"zone_id": "f77a8816-3049-40cd-8484-82919275ddc3",
"apgroup_id": "5aa9383e-ca82-41da-bb4f-e804f48de9bf",
"wlangroup_id": "a631da42-771e-11e9-91f9-22d1e8e61ae8",
"type": "2.4GHZ"
}
}

# Controller Id's need to match the position in the list
CONTROLLERS = [
{
'id': 0,
'type': 'ruckus',
'ip': '10.68.20.250',
'port': 8443,
'url': 'https://{}:{}/wsg/api/public',
'topology': RUCKUS_INIT_TOPOLOGY,
'username': 'admin',
'password': <PASSWORD>
},
{
'id': 1,
'type': 'i2cat',
'ip': '10.68.34.16',
'port': 8008,
'url': 'http://{}:{}'
}
]
14 changes: 14 additions & 0 deletions proxy/lib/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2017-2022 Univertity of Bristol - High Performance Networks Group
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
Binary file added proxy/lib/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
192 changes: 192 additions & 0 deletions proxy/lib/adapters/i2cat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2017-2022 Univertity of Bristol - High Performance Networks Group
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import json
import requests

_headers = {
'Content-type': 'application/json',
"Accept": "application/json",
'Cache-Control': 'no-cache'
}

class I2catController(object):
"""Integration with FlexRAN solution
Arguments:
Wireless {[type]} -- [description]
"""
def __init__(self,
controller_id=None,
ip='127.0.0.1',
port=8080,
url=None):
self.id = controller_id
self._ip = ip
self._port = port
self._url = url.format(ip,port)


# chunkete-topology-controller implementation
def getChunketeTopology(self):
url = (self._url + "/chunkete/topology").format(self._ip, str(self._port))

resp = requests.get(url)
data = json.loads(resp.text)
return data, resp.status_code

def putInterfaceLTEConfig(self, phy_id, parameters):
url = self._url + \
"/chunkete/topology/physicalInterface/{}/LTEConfig".format(
phy_id)
resp = requests.put(
url,
data=parameters,
headers=_headers
)
data = json.loads(resp.text)
return data, resp.status_code

def putInterfaceType(self, phy_id, phy_type):
url = "http://{}:{}/chunkete/topology/physicalInterface/{}/type/{}".format(
self._ip, str(self._port), phy_id, phy_type)
resp = requests.put(
url,
headers=_headers
)
data = json.loads(resp.text)
return data, resp.status_code

def putInterfaceWiredConfig(self, phy_id, parameters):
url = "http://{}:{}/chunkete/topology/physicalInterface/{}/wiredConfig".format(
self._ip, str(self._port), phy_id)
resp = requests.put(
url,
data=parameters,
headers=_headers
)
data = json.loads(resp.text)
return data, resp.status_code

def putInterfaceWirelessConfig(self, phy_id, parameters):
url = self._url + "/chunkete/topology/physicalInterface/{}/wirelessConfig".format(
phy_id)
resp = requests.put(
url,
data=parameters,
headers=_headers
)
data = json.loads(resp.text)
return data, resp.status_code


# chunkete-chunk-controller implementation
def getAllChunks(self):
url = "http://{}:{}/chunkete/chunk".format(
self._ip,
str(self._port))

resp = requests.get(url)
data = json.loads(resp.text)
return data, resp.status_code

def registerNewChunk(self, content):
pre_chunk_list, code = self.getAllChunks()
pre_chunk_ids = [x["id"] for x in pre_chunk_list]

url = "http://{}:{}/chunkete/chunk".format(
self._ip, str(self._port))
resp = requests.post(
url,
data=content,
headers=_headers
)

post_chunk_list, code = self.getAllChunks()
post_chunk_ids = [x["id"] for x in post_chunk_list]

chunk_id = [x for x in post_chunk_ids if x not in pre_chunk_ids][0]

data = json.loads(resp.text)
return data, resp.status_code

def getChunkById(self, chunk_id):
url = "http://{}:{}/chunkete/chunk/{}".format(
self._ip, str(self._port), chunk_id)
resp = requests.get(
url,
headers=_headers
)
data = json.loads(resp.text)
return data, resp.status_code

def removeExistingChunk(self, chunk_id):
url = "http://{}:{}/chunkete/chunk/{}".format(
self._ip, str(self._port), chunk_id)
resp = requests.delete(
url,
headers=_headers
)
if resp.status_code == 200:
data = resp.text
else:
data = json.loads(resp.text)
return data, resp.status_code


# chunkete-swam-controller implementation
def getAllSWAMServices(self, chunk_id):
url = "http://{}:{}/chunkete/chunk/{}/service/SWAM".format(
self._ip, str(self._port), chunk_id)
resp = requests.get(
url,
headers=_headers
)
data = json.loads(resp.text)
return data, resp.status_code

def registerNewSWAMService(self, chunk_id, content):
url = "http://{}:{}/chunkete/chunk/{}/service/SWAM".format(
self._ip, str(self._port), chunk_id)
resp = requests.post(
url,
data=content,
headers=_headers
)
data = json.loads(resp.text)
return data, resp.status_code

def getSWAMServiceById(self, chunk_id, service_id):
url = "http://{}:{}/chunkete/chunk/{}/service/SWAM/{}".format(
self._ip, str(self._port), chunk_id, service_id)
resp = requests.get(
url,
headers=_headers
)
data = json.loads(resp.text)
return data, resp.status_code

def removeExistingSWAMService(self, chunk_id, service_id):
url = "http://{}:{}/chunkete/chunk/{}/service/SWAM/{}".format(
self._ip, str(self._port), chunk_id, service_id)
resp = requests.delete(
url,
headers=_headers
)
if resp.text:
data = json.loads(resp.text)
else:
data = ''
return data, resp.status_code
Loading

0 comments on commit 8ddba21

Please sign in to comment.