Commit fa54bce7 authored by Binh Nguyen's avatar Binh Nguyen

Clean up comments in simeca_controller

parent d1fd84f0
This diff is collapsed.
Copyright (c) Binh Nguyen University of Utah (binh@cs.utah.edu)
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.
#Copyright Binh Nguyen University of Utah (binh@cs.utah.edu)
#
#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/python
from ryu.controller.handler import CONFIG_DISPATCHER
......@@ -104,13 +118,6 @@ class AccessSwitch:
ssh_p = subprocess.Popen(["ssh", self._ENB2_NODE, "ifconfig | grep -B1 192.168.6.90"], stdout=subprocess.PIPE)
self._enb2_net_d_mac = re.search(r'HWaddr (.*)',ssh_p.communicate()[0]).group(1).split()[0]
#ssh_p = subprocess.Popen(["ssh", self._ALICE_NODE, "ifconfig | grep -B1 192.168.3.100 | head -1 | cut -d\" \" -f1"], stdout=subprocess.PIPE)
#self._ALICE_AN_LTE_INTERFACE = ssh_p.communicate()[0].rstrip()
#ssh_p = subprocess.Popen(["ssh", self._BOB_NODE, "ifconfig | grep -B1 192.168.3.101 | head -1 | cut -d\" \" -f1"], stdout=subprocess.PIPE)
#self._BOB_AN_LTE_INTERFACE = ssh_p.communicate()[0].rstrip()
#print "ALICE_AN_LTE_INTERFACE=%s, BOB_AN_LTE_INTERFACE=%s" % (self._ALICE_AN_LTE_INTERFACE, self._BOB_AN_LTE_INTERFACE)
#print "enb-net-d-mac = %s, sgw_net_d_mme_mac = %s, off1_offload_mac= = %s" % (self._enb_net_d_mac, self._sgw_net_d_mme_mac, self._off1_offload_mac)
'''
Set default route for offloading node (after _get_MACs())
......@@ -121,29 +128,14 @@ class AccessSwitch:
self._off1_offload_dev = ssh_p.communicate()[0]
ssh_p = subprocess.Popen(["ssh", self._OFFLOAD_NODE, "sudo ip route add 192.168.3.0/24 dev %s" % self._off1_offload_dev], stdout=subprocess.PIPE)
ssh_p.communicate()
#ssh_p = subprocess.Popen(["ssh", self._BOB_NODE, "sudo ifconfig %s mtu 1400 up" % self._BOB_AN_LTE_INTERFACE], stdout=subprocess.PIPE)
#ssh_p.communicate()
#ssh_p = subprocess.Popen(["ssh", self._ALICE_NODE, "sudo ifconfig %s mtu 1400 up" % self._ALICE_AN_LTE_INTERFACE], stdout=subprocess.PIPE)
#ssh_p.communicate()
#ssh_p = subprocess.Popen(["ssh", self._OFFLOAD_NODE, "ifconfig | grep -B1 192.168.10.11"], stdout=subprocess.PIPE)
#self._off1_offload_mac = re.search(r'HWaddr (.*)',ssh_p.communicate()[0]).group(1).split()[0]
#ssh_p = subprocess.Popen(["ssh", self._OFFLOAD_NODE, "sudo ip route add 192.168.3.0/24 dev %s" % self._off1_offload_mac], stdout=subprocess.PIPE)
def _build_database(self):
#if os.path.isfile(self._OFFLOAD_DB) and os.path.isfile(self._USER_DB):
#offload_db = open(self._OFFLOAD_DB)
if os.path.isfile(self._USER_DB):
user_db = open(self._USER_DB)
#Get registered offload IPs
#line = offload_db.readline()
#while line:
# if line.split()[0] != "":
# self._offload_db.append(line.split()[0])
# line = offload_db.readline()
line = user_db.readline()
while line:
......@@ -861,15 +853,6 @@ class AccessSwitch:
ovs-ofctl add-flow br0 in_port=$GTP,priority=2,actions=output:$sgw_inf
'''
print "*****CONTROLLER: Pushing UPLINK flows for UE %s, offloading server %s, sgw-gtpid %s ....." % (ue_ip,offload_ip,sgw_teid)
#uplink_flow_to_gtp = 'in_port=%s,priority=3,eth_type=%s,nw_proto=17,tp_dst=%d,actions=output:%d' %\
#(self.enb_inf, self._IP_TYPE, self._GTP_PORT, self._GTP)
#uplink_flow_gtp = 'in_port=%d,priority=3,tun_id=%s,tun_src=%s,tun_dst=%s,actions=mod_dl_dst:%s,output:%d'%\
#(self._GTP, sgw_teid, ue_ip, offload_ip, self._off1_offload_mac, self._DECAP_PORT)
#uplink_flow_from_gtp = 'in_port=%d,priority=3,eth_type=%s,nw_src=%s,nw_dst=%s,actions=output:%s' %\
#(self._DECAP_PORT, self._IP_TYPE, ue_ip, offload_ip, self.offload_inf)
#uplink_normal_gtp = "in_port=%d,priority=2,actions=output:%s" % (self._GTP, self.sgw_inf)
#1
#match = self.parser.OFPMatch(in_port=self.enb_inf,eth_type=self._IP_TYPE,nw_proto=17,tp_dst=self._GTP_PORT)
......@@ -920,17 +903,10 @@ class AccessSwitch:
ovs-ofctl add-flow br0 in_port=$ENCAP,priority=2,eth_type=$IP_TYPE,actions=output:$enb_inf
'''
print "******Pushing DOWNLINK flows for eNB GTPID %s, eNB IP %s, sgw IP %s ....." % (enb_teid, enb_ip, sgw_ip)
#downlink_flow = 'in_port=%s,priority=2,eth_type=%s,actions=mod_dl_dst:%s,mod_dl_src=%s,set_field:%s->tun_id,set_field:%s->tun_dst,set_field:%s->tun_src,output:%d' %\
#(self.offload_inf, self._IP_TYPE, self._enb_net_d_mac, self._sgw_net_d_mme_mac, enb_teid, enb_ip, sgw_ip, self._ENCAP_PORT)
#downlink_flow_gtp = 'in_port=%d,priority=2,eth_type=%s,actions=output:%s' %\
#(self._ENCAP_PORT, self._IP_TYPE, self.enb_inf)
#1
match = self.parser.OFPMatch(in_port=self.offload_inf,eth_type=self._IP_TYPE)
actions = []
#actions.append(self.parser.OFPActionSetField(dl_dst=self._enb_net_d_mac,dl_src=self._sgw_net_d_mme_mac,tunnel_id=enb_teid,tun_dst=enb_ip,tun_src=sgw_ip)
#actions.append(self.parser.OFPActionSetField(tunnel_id=enb_teid,tun_dst=enb_ip,tun_src=sgw_ip))
actions.append(self.parser.OFPActionSetField(eth_dst=self._enb_net_d_mac))
actions.append(self.parser.OFPActionSetField(eth_src=self._sgw_net_d_mme_mac))
actions.append(self.parser.OFPActionSetField(tunnel_id=enb_teid))
......
This diff is collapsed.
#Copyright Binh Nguyen University of Utah (binh@cs.utah.edu)
#
#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.
#
#An entry after matching init and response msgs.
#This entry contains information to:
......
#Copyright Binh Nguyen University of Utah (binh@cs.utah.edu)
#
#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.
#
#Detach request message
#
......
This diff is collapsed.
#Copyright Binh Nguyen University of Utah (binh@cs.utah.edu)
#
#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.
class Dp:
def __init__(self, dpid, dp, of, ofp):
self.dpid = dpid
......
#Copyright Binh Nguyen University of Utah (binh@cs.utah.edu)
#
#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.
class Dpset:
dpset = {}
#def __init__(self):
......
#Copyright Binh Nguyen University of Utah (binh@cs.utah.edu)
#
#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.
class S1HoInfo:
def __init__(self, ue_ip, ue_imsi, ue_mme_id, ue_enb_id, senb_cellid, tenb_cellid, senb_ip, tenb_ip, senb_teid, tenb_teid, sgw_ip, sgw_teid):
self.ue_ip = ue_ip
......
This diff is collapsed.
#Copyright Binh Nguyen University of Utah (binh@cs.utah.edu)
#
#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.
#
#NAS message: InitialContextSetupRequest or "Activate default EPS bearer context request"
#
......
# Copyright (C) 2012 Nippon Telegraph and Telephone Corporation.
#Copyright Binh Nguyen University of Utah (binh@cs.utah.edu)
#
# 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
#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.
#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 logging
......
# Copyright (C) 2012 Nippon Telegraph and Telephone Corporation.
#Copyright Binh Nguyen University of Utah (binh@cs.utah.edu)
#
# 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
#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.
#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 logging
import json
......@@ -185,7 +183,6 @@ class RestIoTApi(app_manager.RyuApp):
Dispatcher.netd_port = kwargs['sgw_inf']
Dispatcher.offload_inf = kwargs['offload_inf']
Dispatcher.dpset = kwargs['dpset']
#Dispatcher.servers = kwargs['servers']
Dispatcher.get_enb_location_ip_map('%s/ENB.data' % self._CONF)
......@@ -198,8 +195,6 @@ class RestIoTApi(app_manager.RyuApp):
Dispatcher.locationrouting = LocationRouting(Dispatcher.dpset, Dispatcher.access_switches, Dispatcher.switchname_to_dpid)
Dispatcher.access_switch_gtp = AccessSwitchGtp(Dispatcher.dpset, Dispatcher.switchname_to_dpid, Dispatcher.access_switches)
#Dispatcher.attached_ue_ip = open('../iot-controller-eval/e2e_delay_exp/ATTACHED_IP.data','w',0)
#Dispatcher.p2p_existed_ip = open('../iot-controller-eval/e2e_delay_exp/P2P_IP.data','w',0)
Dispatcher.get_imsi_server_name_map('%s/IMSI_1.data' % (self.DATA))
Dispatcher.get_imsi_server_name_map('%s/IMSI_2.data' % (self.DATA))
......@@ -212,26 +207,16 @@ class RestIoTApi(app_manager.RyuApp):
Dispatcher.imsi_to_ip = open ('/tmp/IMSI_IP.log', 'w', 0)
Dispatcher.imsi_to_ip = open ('/tmp/IMSI_IP.log', 'a', 0)
#test
#for i in range(1,300):
# Dispatcher._allocate_ipv4('0011040')
##Dispatcher._get_MACs()
Dispatcher.set_default_route_servers()
#Dispatcher.build_database()
Dispatcher.del_flows_ryu()
Dispatcher.push_arp_server()
#Install prefix shortespath route in SDN core
Dispatcher.installCoreRoute()
if ENABLE_OVS_GTP==0:
#Dispatcher.push_arp_as()
#Dispatcher.set_static_arp_enb()
#Dispatcher.set_static_ip_route_enb() #for c2s to work.
LOG.info("")
Dispatcher.access_switch_gtp.push_flows_bridging_ryu()
#for enb_cellid in Dispatcher.enb_location_ip_map:
# Dispatcher._set_default_route_enb_prefix('192.190.0.0/16', enb_cellid)
LOG.info ("-----------IoT listener/dispatcher init DONE: Listening for commands ....---------")
......
#Copyright Binh Nguyen University of Utah (binh@cs.utah.edu)
#
#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.
#
#p2p_info
#
......
#Copyright Binh Nguyen University of Utah (binh@cs.utah.edu)
#
#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/python
import json
#import requests
......
# Copyright (C) 2012 Nippon Telegraph and Telephone Corporation.
#Copyright Binh Nguyen University of Utah (binh@cs.utah.edu)
#
# 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
#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.
#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 logging
......@@ -808,16 +809,12 @@ class RestStatsApi(app_manager.RyuApp):
mapper = wsgi.mapper
wsgi.registory['SimecaController'] = self.data
#wsgi.registory['Sniffer'] = self.data
path = '/stats'
uri = path + '/switches'
mapper.connect('stats', uri,
controller=SimecaController, action='get_dpids',
conditions=dict(method=['GET']))
#mapper.connect('stats', uri,
# controller=Sniffer, action='test_rest_api',
# conditions=dict(method=['GET']))
uri = path + '/desc/{dpid}'
......
#Copyright Binh Nguyen University of Utah (binh@cs.utah.edu)
#
#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.
#
#S1AP message.
#
......
#Copyright Binh Nguyen University of Utah (binh@cs.utah.edu)
#
#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/python
from ryu.controller.handler import CONFIG_DISPATCHER
......
# Copyright (C) 2012 Nippon Telegraph and Telephone Corporation.
# Copyright (C) 2012 Isaku Yamahata <yamahata at private email ne jp>
#Copyright Binh Nguyen University of Utah (binh@cs.utah.edu)
#
# 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
#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.
# This module updates OVS tunnel ports for OpenStack integration.
#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 collections
from ryu import cfg
......
#Copyright Binh Nguyen University of Utah (binh@cs.utah.edu)
#
#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 logging
import json
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment