BAL and Maple Release 2.2

Signed-off-by: Shad Ansari <developer@Carbon.local>
diff --git a/bal_release/scripts/bal_autostart.ini b/bal_release/scripts/bal_autostart.ini
new file mode 100644
index 0000000..129eb49
--- /dev/null
+++ b/bal_release/scripts/bal_autostart.ini
@@ -0,0 +1,117 @@
+# ========================================================================
+#
+# This is a sample bal_autostart.ini file.  If used, it must reside in 
+# the same directory as the bcm_sdn_agent executable.  
+#
+# Examples for EPON ,GPON, XGPON1, and XGSPON systems are given below.  You cannot mix
+# EPON / GPON / XGPON1 / XGSPON entries in this file.  Systems are assumed to be either
+# EPON or GPON or XGPON1 or XGSPON (as determined by the entry for topology.pon_mode in
+# the bal_config.ini file).  NGPON2 systems are not supported by the autostart feature
+# or BAL code at this time.
+#
+# ========================================================================
+# This is a sample autostart script for a MAPLE EPON system, 
+# where ONUs are identified by their MAC address
+#
+# NOTE: This script is only useable on an SDN version
+# of BAL, that is, with the bcm_sdn_agent.  
+#
+# On startup, the bcm_sdn_agent code reads this autostart file,
+# then:
+# - brings up the access-terminal
+# - brings up each interface specified in the entry list
+# - brings up a subscriber-terminal for each ONU entry
+#
+# ONU IDs can overlap on different PON interfaces
+#
+# Entry format for an EPON system is:
+# onu=ONU ID, int=PON INTERFACE ID, mac=MAC ADDRESS OF THE ONU
+# e.g.
+# onu=3, int=2, mac=00:33:23:33:33:98
+# ========================================================================
+# 
+# Uncomment-out entries below and modify them for your EPON system
+#
+#onu=1, int=0, mac=00:10:18:ad:69:d0
+#onu=6, int=0, mac=00:10:18:ad:63:38
+#onu=3, int=2, mac=00:10:18:ad:66:74
+#onu=12, int=0, mac=00:10:18:ad:29:32
+#onu=3, int=1, mac=00:10:18:ad:59:22
+#onu=3, int=0, mac=00:10:18:ad:68:44
+
+
+
+# ========================================================================
+# This is a sample autostart script for a MAPLE GPON system, 
+# where ONUs are identified by their password and serial number
+#
+# NOTE: This script is only useable on an SDN version
+# of BAL, that is, with the bcm_sdn_agent  
+#
+# On startup, the bcm_sdn_agent code reads this autostart file,
+# then:
+# - brings up the access-terminal
+# - brings up each interface specified in the entry list
+# - brings up a subscriber-terminal for each ONU entry
+#
+# ONU IDs can overlap on different PON interfaces
+#
+# Entry format for an GPON system is:
+# onu=ONU ID, int=PON INTERFACE ID, vend=VENDOR ID, pass=PASSWORD
+# e.g.
+# onu=3, int=2, vend=VENDOR ID FROM ONU LABEL, pass=ONU PASSWORD
+#
+# NOTE: If bcm_sdn_agent is started in autonoumous ONU activation mode (-O or --auto_activate command line option),
+# vend and pass parameters should be set as 0. In this case, the system does not bring the
+# subscriber terminal up. The subscriber terminal will be activated automatically when discovered. 
+# Note that ONU entries with with vend & pass equal and not-equal 0 can be mixed. In this case,
+# some subscriber terminals will be pre-configured, before they are discovered 
+# ===================================================================
+#
+# Uncomment-out entries below and modify them for your GPON system
+#
+#onu=1, int=0, vend=4252434d01946121, pass=31323334353637383930
+#onu=6, int=0, vend=4252434d01946132, pass=31323334353637383930
+#
+# Uncomment the entry below if bcm_sdn_agent is started in autonomous ONU 
+# activation mode (-O or --auto_activate). The entry below will cause PON 
+# interface 2 to be enabled. ONUs will be activated automatically when discovered
+#
+#onu=1, int=2, vend=00, pass=00
+
+
+# ========================================================================
+# This is a sample autostart script for a MAPLE XGPON1 or XGSPON system, 
+# where ONUs are identified by their password and registration ID
+#
+# NOTE: This script is only useable on an SDN version
+# of BAL, that is, with the bcm_sdn_agent  
+#
+# On startup, the bcm_sdn_agent code reads this autostart file,
+# then:
+# - brings up the access-terminal
+# - brings up each interface specified in the entry list
+# - brings up a subscriber-terminal for each ONU entry
+#
+# ONU IDs can overlap on different PON interfaces
+#
+# Entry format for an XGPON1 or XGSPON system is:
+# onu=ONU ID, int=PON INTERFACE ID, vend=VENDOR ID, registration_id=REGISTRATION_ID
+# e.g.
+# onu=3, int=2, vend=VENDOR ID FROM ONU LABEL, registration_id=REGISTRATION_ID
+# 
+# As in case with GPON, bcm_sdn_agent controlling XGPON1 or XGSPON system can be started in autonomous
+# ONU activation mode. In this case vend and registration_id should be set 0.
+# The ONU will be activated automatically when discovered 
+# ===================================================================
+#
+# Uncomment-out entries below and modify them for your XGPON1 or XGSPON system
+#
+#onu=1, int=0, vend=4252434d01946121, registration_id=202020202020202020202020202020202020202020202020202020202020202020202020
+#onu=6, int=0, vend=4252434d01946132, registration_id=202020202020202020202020202020202020202020202020202020202020202020202020
+#
+# Uncomment the entry below if bcm_sdn_agent is started in autonomous ONU 
+# activation mode (-O or --auto_activate). The entry below will cause PON 
+# interface 2 to be enabled. ONUs will be activated automatically when discovered
+#
+#onu=1, int=2, vend=00, registration_id=00
diff --git a/bal_release/scripts/bal_config.ini b/bal_release/scripts/bal_config.ini
new file mode 100644
index 0000000..a48ab23
--- /dev/null
+++ b/bal_release/scripts/bal_config.ini
@@ -0,0 +1,24 @@
+iwf_mode=direct
+# Mapping table between Qumran and Maple: 3-separate QaX/Maple SVKs, 4-SVK4
+intf_maptable=3
+num_nni_ports=1
+# UDP port where bcm.user listens for pkt_send messages from core (needed for remote bcm.user only!)
+pkt_send_svr_listen_port=50002
+# UDP port where the core listens for pkt_rcv message from bcm.user (needed for remote bcm.user only!)
+trap_udp_port=50001
+
+# The following topology configuration (currently commented out) is an alternative for bal_topology.ini.
+# In case both exist, bal_topology.ini takes precedence over this configuration.
+topology.num_of_devs=1
+topology.num_of_pons_per_dev=2
+# Allowed pon modes are: gpon|xgpon|xgs|ngpon2|epon_tdma|epon_1g|epon_10g
+topology.pon_mode=xgs
+
+#enable (y) or disable (n) loopback mode in MAC (does not need access to Maple HW if enabled)
+#mac_loopback=y
+
+# Enable NNI auto-negotiation on NNI port <n>.
+# It is known to work on NNI0 with some 1G transceivers, however
+# this mode wasn't tested on NNI interfaces other than 0 and/or with different transceivers.
+# Use at your own risk
+# autoneg_nni<n>=y
diff --git a/bal_release/scripts/bal_setup_svk4.sh b/bal_release/scripts/bal_setup_svk4.sh
new file mode 100755
index 0000000..ceb1cc2
--- /dev/null
+++ b/bal_release/scripts/bal_setup_svk4.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+#
+# Start bal devices
+#
+
+case "$1" in
+    start)
+	echo -n "Starting bal devices: "
+        /broadcom/mk_bcm_node.sh
+        /broadcom/svk_init_startup.sh
+	echo "OK"
+	;;
+    stop)
+	echo "OK"
+	;;
+    restart|reload)
+	;;
+    *)
+	echo "Usage: $0 {start|stop|restart}"
+	exit 1
+esac
+
+exit $?
diff --git a/bal_release/scripts/bal_topology.ini b/bal_release/scripts/bal_topology.ini
new file mode 100644
index 0000000..4cf96ec
--- /dev/null
+++ b/bal_release/scripts/bal_topology.ini
@@ -0,0 +1,18 @@
+# Logical PON ID, PON Mode (gpon|xgpon|epon_10g|xgs|ngpon2), Physical Device ID, Physical PON ID
+# Comments below contain gpon configuration example
+#0, gpon, 0, 0
+#1, gpon, 0, 1
+#2, gpon, 0, 2
+#3, gpon, 0, 3
+#4, gpon, 0, 4
+#5, gpon, 0, 5
+#6, gpon, 0, 6
+#7, gpon, 0, 7
+#8, gpon, 0, 8
+#9, gpon, 0, 9
+#10, gpon, 0, 10
+#11, gpon, 0, 11
+#12, gpon, 0, 12
+#13, gpon, 0, 13
+#14, gpon, 0, 14
+#15, gpon, 0, 15
diff --git a/bal_release/scripts/bcm_user_start_stop b/bal_release/scripts/bcm_user_start_stop
new file mode 100755
index 0000000..0e3985c
--- /dev/null
+++ b/bal_release/scripts/bcm_user_start_stop
@@ -0,0 +1,72 @@
+#!/bin/bash
+#
+# Start/Stop BCM.USER
+#
+
+# 
+# Set the directory path to bcm.user, or 
+# allow the user to specify the path to bcm.user as the second argument when calling this script 
+# (the first argument must be one of: [ start, stop ]
+#
+if [ -z $2 ]; then
+
+# Look for bcm.user, set the starting directory appropriately, or
+# simple exit if not found
+#
+if [ -f /mnt/bcm.user ]; then
+BCM_USER_BIN_DIR=/mnt/
+elif [ -f /broadcom/bcm.user ]; then
+BCM_USER_BIN_DIR=/broadcom
+elif [ -f /opt/bcm56450/bcm.user ]; then
+BCM_USER_BIN_DIR=/opt/bcm56450
+elif [ -f ./bcm.user ]; then
+BCM_USER_BIN_DIR=.
+else
+echo "cannot find bcm.user, exiting"
+exit 1
+fi
+
+else # the user may choose the starting directory directly using the second argment 
+BCM_USER_BIN_DIR=$2
+fi   
+
+case "$1" in
+  start)
+  	echo -n "Starting bcm.user: "
+	cd ${BCM_USER_BIN_DIR}
+        lsmod | grep -q linux_user_bde > /dev/null
+        if [ "$?" == "0" ]; then
+            rmmod linux_user_bde
+            echo -n "(-user)"
+        fi
+
+        lsmod | grep -q linux_kernel_bde > /dev/null
+        if [ "$?" == "0" ]; then
+            rmmod linux_kernel_bde
+            echo -n "(-kernel)"
+        fi
+
+#
+# The linux_kernel_bde and linux_user_bde modules are loaded by the bcm.user executable
+#
+
+# Create the linux device file, if it does not already exist
+        if [ ! -c /dev/linux-user-bde ]; then
+            mknod /dev/linux-user-bde c 126 0
+        fi
+        ./bcm.user
+	echo "OK"
+	;;
+  stop)
+	echo -n "Stopping bcm.user: "
+	pkill -f bcm.user
+	echo "OK"
+	;;
+  restart|reload)
+	;;
+  *)
+	echo "Usage: $0 {start|stop|restart}"
+	exit 1
+esac
+
+exit $?
diff --git a/bal_release/scripts/maple_start_stop b/bal_release/scripts/maple_start_stop
new file mode 100755
index 0000000..bd81d75
--- /dev/null
+++ b/bal_release/scripts/maple_start_stop
@@ -0,0 +1,57 @@
+#!/bin/sh
+#
+# Start/Stop Maple
+#
+case "$1" in
+  start)
+  	echo -e  "Checking if svk_init.sh calls trx_init.sh\n"
+  	cd /opt/bcm68620
+  	if [ ! -e trx_init.sh ]; then
+  	    echo "trx_init.sh not present" && cd - && exit 1
+  	fi
+  	if [ -z "`grep "./bcm_user_appl < trx_init.sh" svk_init.sh`" ]; then
+  	    echo "svk_init.sh does not call trx_init.sh" && cd - && exit 1
+  	elif [[ ! -z "`grep "./bcm_user_appl < trx_init.sh" svk_init.sh | grep "^\s*#\s*"`" ]]; then
+  	    echo "call to trx_init.sh is commented out in svk_init.sh" && cd - && exit 1
+  	fi
+
+        echo -n "Starting MAPLE: "
+        cd /opt/bcm68620 && ./svk_init.sh --proxy 40000
+ 	;;
+  stop)
+        echo -n "Stopping Maple: "
+        pkill -f bcm_user_appl
+        if [ ! -z "`lsmod | grep -m 1 coop_dba_linux`" ]; then
+	    rmmod coop_dba_linux
+        fi
+        if [ ! -z "`lsmod | grep -m 1 bcm_dev_ctrl_linux`" ]; then
+	    rmmod bcm_dev_ctrl_linux
+        fi
+        if [ ! -z "`lsmod | grep -m 1 i2c_devs`" ]; then
+	    rmmod i2c_devs.ko
+        fi
+        if [ ! -z "`lsmod | grep -m 1 os_linux`" ]; then
+	    rmmod os_linux.ko
+        fi
+        if [ ! -z "`lsmod | grep -m 1 ll_pcie`" ]; then
+	    rmmod ll_pcie.ko
+        fi
+        if [ -e /dev/maple_dev_ctrl ]; then
+	    rm /dev/maple_dev_ctrl
+        fi
+        LOCK_DIR_INIT=/tmp/bcm68620_svk_init
+        LOCK_DIR_KERNEL_LOG_OWNED=/tmp/bcm68620_kernel_log_owned
+        rm -fr $LOCK_DIR_INIT
+        rm -fr $LOCK_DIR_KERNEL_LOG_OWNED
+        echo "OK"
+	;;
+  restart|reload)
+        "$0" stop
+        "$0" start
+	;;
+  *)
+	echo "Usage: $0 {start|stop|restart}"
+	exit 1
+esac
+
+exit $?
diff --git a/bal_release/scripts/ryu/PON_topology_100_flow_add_then_delete_all.py b/bal_release/scripts/ryu/PON_topology_100_flow_add_then_delete_all.py
new file mode 100644
index 0000000..16e3b1f
--- /dev/null
+++ b/bal_release/scripts/ryu/PON_topology_100_flow_add_then_delete_all.py
@@ -0,0 +1,112 @@
+# Copyright (C) 2011 Nippon Telegraph and Telephone Corporation.

+#

+# 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

+

+from ryu.base import app_manager

+from time import sleep

+from ryu.controller import ofp_event

+from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER

+from ryu.controller.handler import set_ev_cls

+from ryu.ofproto import ofproto_v1_3

+from ryu.lib.packet import packet

+from ryu.lib.packet import ethernet

+from ryu.lib import addrconv

+

+LOG = logging.getLogger('ryu.app.pon_topology')

+

+class PonTopology13(app_manager.RyuApp):

+    OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]

+

+    def __init__(self, *args, **kwargs):

+        super(PonTopology13, self).__init__(*args, **kwargs)

+        self.mac_to_port = {}

+

+    @set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)

+    def switch_features_handler(self, ev):

+        datapath = ev.msg.datapath

+

+        # This does nothing if flows have not been previously configured in the OF agent

+        self.del_all_flows(datapath)

+

+        # Configure the flows (VID 100)

+        #

+        # Ports 1-128 are implicitly mapped to UNI-0 on ONU 1->128

+        # Ports 129 and above are implicitly mapped to OLT NNI-0 and above

+        self.add_vid_flow(datapath,10000, 1, 129, 100, 0)

+        self.add_vid_flow(datapath,10001, 129, 1, 100, 0)

+

+        sleep(1)

+        self.send_barrier(datapath)

+

+        sleep(5)

+        

+        self.del_all_flows(datapath)

+

+    @set_ev_cls(ofp_event.EventOFPPortStatus, MAIN_DISPATCHER)

+    def port_status_handler(self, ev):

+        LOG.debug('port_status_handler port id: %d', ev.msg.desc.port_no)

+

+    def add_meter(self, datapath, meter_id, rate):

+        ofproto = datapath.ofproto

+        parser = datapath.ofproto_parser

+        band = parser.OFPMeterBandDrop(burst_size=0, rate=rate)

+        mod = parser.OFPMeterMod(datapath=datapath,command=ofproto.OFPMC_ADD, flags=ofproto.OFPMF_KBPS, meter_id=meter_id, bands=[band])

+        LOG.info("add_meter: meter_id=%d, rate=%d KBPS")

+        datapath.send_msg(mod)

+

+    def add_vid_flow(self, datapath, cookie, src_port, dst_port, vid, meter_id):

+        ofproto = datapath.ofproto

+        parser = datapath.ofproto_parser

+        actions = [parser.OFPActionOutput(dst_port)]

+        if meter_id != 0:

+            inst = [parser.OFPInstructionActions(ofproto.OFPIT_APPLY_ACTIONS,actions), parser.OFPInstructionMeter(meter_id)]

+        else:

+            inst = [parser.OFPInstructionActions(ofproto.OFPIT_APPLY_ACTIONS,actions)]

+

+        # NOTE: 0x1000 is OR'd into the vid to set the OFPVID_PRESENT flag in the OpenFlow FLOW_MOD (OFPFC_ADD) 

+        # message match field.

+        match = parser.OFPMatch(in_port=src_port, vlan_vid=(vid | 0x1000))

+        mod = parser.OFPFlowMod(datapath=datapath,

+                                cookie=cookie, 

+                                cookie_mask=32767, 

+                                priority=0, 

+                                match=match, 

+                                instructions=inst)

+        LOG.info("add_vid_flow: src_port=%d dst_port=%d vid=%d meter=%d cookie=%d", 

+                 src_port, dst_port, vid, meter_id, cookie)

+        datapath.send_msg(mod)

+

+    def del_flow(self, datapath, cookie):

+        LOG.info("del_flow: cookie=%d", cookie)

+        self._del_flow(datapath, cookie, 32767)

+

+    def del_all_flows(self, datapath):

+        LOG.info("del_all_flows")

+        # Cookie 0 (argument 2) tells the OF agent to delete all configured flows

+        self._del_flow(datapath, 0, 0)

+

+    def _del_flow(self, datapath, cookie, mask):

+        ofproto = datapath.ofproto

+        parser = datapath.ofproto_parser

+ 

+        mod = parser.OFPFlowMod(

+            datapath=datapath, match=None, cookie=cookie, cookie_mask=mask,

+            command=ofproto.OFPFC_DELETE)

+        datapath.send_msg(mod)

+

+    def send_barrier(self, datapath):

+        LOG.info("send_barrier")

+        datapath.send_barrier()

+                   

diff --git a/bal_release/scripts/ryu/PON_topology_100_flow_add_then_delete_all_loop.py b/bal_release/scripts/ryu/PON_topology_100_flow_add_then_delete_all_loop.py
new file mode 100644
index 0000000..ad87847
--- /dev/null
+++ b/bal_release/scripts/ryu/PON_topology_100_flow_add_then_delete_all_loop.py
@@ -0,0 +1,120 @@
+# Copyright (C) 2011 Nippon Telegraph and Telephone Corporation.

+#

+# 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

+

+from ryu.base import app_manager

+from time import sleep

+from ryu.controller import ofp_event

+from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER

+from ryu.controller.handler import set_ev_cls

+from ryu.ofproto import ofproto_v1_3

+from ryu.lib.packet import packet

+from ryu.lib.packet import ethernet

+from ryu.lib import addrconv

+

+LOG = logging.getLogger('ryu.app.pon_topology')

+

+class PonTopology13(app_manager.RyuApp):

+    OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]

+

+    def __init__(self, *args, **kwargs):

+        super(PonTopology13, self).__init__(*args, **kwargs)

+        self.mac_to_port = {}

+

+    @set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)

+    def switch_features_handler(self, ev):

+        datapath = ev.msg.datapath

+

+        # Add/Del upstream/downstream flows (VID 100) in a loop to test for leaks in the OF agent

+        #

+        # (NOTE: The first del_all_flows does nothing if flows have not been previously 

+        # configured in the OF agent)

+        while 1:

+            self.del_all_flows(datapath)

+

+            self.add_vid_flow(datapath,10000, 1, 129, 100, 0)

+            self.add_vid_flow(datapath,10001, 129, 1, 100, 0)

+

+            sleep(1)

+            self.send_barrier(datapath)

+          

+            sleep(5)

+        

+ 

+    @set_ev_cls(ofp_event.EventOFPPortStatus, MAIN_DISPATCHER)

+    def port_status_handler(self, ev):

+        LOG.debug('port_status_handler port id: %d', ev.msg.desc.port_no)

+

+    def add_meter(self, datapath, meter_id, rate):

+        ofproto = datapath.ofproto

+        parser = datapath.ofproto_parser

+        band = parser.OFPMeterBandDrop(burst_size=0, rate=rate)

+        mod = parser.OFPMeterMod(datapath=datapath,

+                                 command=ofproto.OFPMC_ADD, 

+                                 flags=ofproto.OFPMF_KBPS, 

+                                 meter_id=meter_id, 

+                                 bands=[band])

+        LOG.info("add_meter: meter_id=%d, rate=%d KBPS")

+        datapath.send_msg(mod)

+

+    def add_vid_flow(self, datapath, cookie, src_port, dst_port, vid, meter_id):

+        ofproto = datapath.ofproto

+        parser = datapath.ofproto_parser

+        actions = [parser.OFPActionOutput(dst_port)]

+        if meter_id != 0:

+            inst = [parser.OFPInstructionActions(ofproto.OFPIT_APPLY_ACTIONS,actions), 

+                    parser.OFPInstructionMeter(meter_id)]

+        else:

+            inst = [parser.OFPInstructionActions(ofproto.OFPIT_APPLY_ACTIONS,actions)]

+

+        # NOTE: 0x1000 is OR'd into the vid to set the OFPVID_PRESENT flag in the OpenFlow FLOW_MOD (OFPFC_ADD) 

+        # message match field.

+        match = parser.OFPMatch(in_port=src_port, vlan_vid=(vid | 0x1000))

+        mod = parser.OFPFlowMod(datapath=datapath,

+                                cookie=cookie, 

+                                cookie_mask=32767, 

+                                priority=0, 

+                                match=match, 

+                                instructions=inst)

+        LOG.info("add_vid_flow: src_port=%d dst_port=%d vid=%d meter=%d cookie=%d", 

+                 src_port, dst_port, vid, meter_id, cookie)

+        datapath.send_msg(mod)

+

+    def del_flow(self, datapath, cookie):

+        LOG.info("del_flow: cookie=%d", cookie)

+        self._del_flow(datapath, cookie, 32767)

+

+    def del_all_flows(self, datapath):

+        LOG.info("del_all_flows")

+        # Cookie 0 (argument 2) tells the OF agent to delete all configured flows

+        self._del_flow(datapath, 0, 0)

+

+    def _del_flow(self, datapath, cookie, mask):

+        ofproto = datapath.ofproto

+        parser = datapath.ofproto_parser

+ 

+        mod = parser.OFPFlowMod(

+            datapath=datapath, match=None, cookie=cookie, cookie_mask=mask,

+            command=ofproto.OFPFC_DELETE)

+        datapath.send_msg(mod)

+    

+    def send_barrier(self, datapath):

+        LOG.info("send_barrier")

+        datapath.send_barrier()

+                   

+

+

+

+                   

diff --git a/bal_release/scripts/ryu/PON_topology_100_flow_add_then_delete_ds_then_us.py b/bal_release/scripts/ryu/PON_topology_100_flow_add_then_delete_ds_then_us.py
new file mode 100644
index 0000000..377903f
--- /dev/null
+++ b/bal_release/scripts/ryu/PON_topology_100_flow_add_then_delete_ds_then_us.py
@@ -0,0 +1,123 @@
+# Copyright (C) 2011 Nippon Telegraph and Telephone Corporation.

+#

+# 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

+

+from ryu.base import app_manager

+from time import sleep

+from ryu.controller import ofp_event

+from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER

+from ryu.controller.handler import set_ev_cls

+from ryu.ofproto import ofproto_v1_3

+from ryu.lib.packet import packet

+from ryu.lib.packet import ethernet

+from ryu.lib import addrconv

+

+LOG = logging.getLogger('ryu.app.pon_topology')

+

+class PonTopology13(app_manager.RyuApp):

+    OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]

+

+    def __init__(self, *args, **kwargs):

+        super(PonTopology13, self).__init__(*args, **kwargs)

+        self.mac_to_port = {}

+

+    @set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)

+    def switch_features_handler(self, ev):

+        datapath = ev.msg.datapath

+

+        # This does nothing if flows have not been previously configured in the OF agent

+        self.del_all_flows(datapath)

+

+        # Configure the flows (VID 100)

+        #

+        # Ports 1-128 are implicitly mapped to UNI-0 on ONU 1-12

+        # Ports 129 and above are implicitly mapped to OLT NNI-0 and above

+        self.add_vid_flow(datapath,10000, 1, 129, 100, 0)

+        self.add_vid_flow(datapath,10001, 129, 1, 100, 0)

+

+        sleep(1)

+        self.send_barrier(datapath)

+

+        sleep(5)

+        

+        # Delete the downstream flow

+        self.del_flow(datapath, 10001)

+        # Then delete the upstream flow

+        self.del_flow(datapath, 10000)

+

+    @set_ev_cls(ofp_event.EventOFPPortStatus, MAIN_DISPATCHER)

+    def port_status_handler(self, ev):

+        LOG.debug('port_status_handler port id: %d', ev.msg.desc.port_no)

+

+    def add_meter(self, datapath, meter_id, rate):

+        ofproto = datapath.ofproto

+        parser = datapath.ofproto_parser

+        band = parser.OFPMeterBandDrop(burst_size=0, rate=rate)

+        mod = parser.OFPMeterMod(datapath=datapath,

+                                 command=ofproto.OFPMC_ADD, 

+                                 flags=ofproto.OFPMF_KBPS, 

+                                 meter_id=meter_id, 

+                                 bands=[band])

+        LOG.info("add_meter: meter_id=%d, rate=%d KBPS")

+        datapath.send_msg(mod)

+

+    def add_vid_flow(self, datapath, cookie, src_port, dst_port, vid, meter_id):

+        ofproto = datapath.ofproto

+        parser = datapath.ofproto_parser

+        actions = [parser.OFPActionOutput(dst_port)]

+        if meter_id != 0:

+            inst = [parser.OFPInstructionActions(ofproto.OFPIT_APPLY_ACTIONS,actions), 

+                    parser.OFPInstructionMeter(meter_id)]

+        else:

+            inst = [parser.OFPInstructionActions(ofproto.OFPIT_APPLY_ACTIONS,actions)]

+

+        # NOTE: 0x1000 is OR'd into the vid to set the OFPVID_PRESENT flag in the OpenFlow FLOW_MOD (OFPFC_ADD) 

+        # message match field.

+        match = parser.OFPMatch(in_port=src_port, vlan_vid=(vid | 0x1000))

+        mod = parser.OFPFlowMod(datapath=datapath,

+                                cookie=cookie, 

+                                cookie_mask=32767, 

+                                priority=0, 

+                                match=match, 

+                                instructions=inst)

+        LOG.info("add_vid_flow: src_port=%d dst_port=%d vid=%d meter=%d cookie=%d", 

+                 src_port, dst_port, vid, meter_id, cookie)

+        datapath.send_msg(mod)

+

+    def del_flow(self, datapath, cookie):

+        LOG.info("del_flow: cookie=%d", cookie)

+        self._del_flow(datapath, cookie, 32767)

+

+    def del_all_flows(self, datapath):

+        LOG.info("del_all_flows")

+

+        # Cookie 0 (argument 2) tells the OF agent to delete all configured flows

+        self._del_flow(datapath, 0, 0)

+

+    def _del_flow(self, datapath, cookie, mask):

+        ofproto = datapath.ofproto

+        parser = datapath.ofproto_parser

+ 

+        mod = parser.OFPFlowMod(datapath=datapath, 

+                                match=None, 

+                                cookie=cookie, 

+                                cookie_mask=mask,

+                                command=ofproto.OFPFC_DELETE)

+        datapath.send_msg(mod)

+

+    def send_barrier(self, datapath):

+        LOG.info("send_barrier")

+        datapath.send_barrier()

+                   

diff --git a/bal_release/scripts/ryu/PON_topology_100_flow_add_then_delete_us_then_ds.py b/bal_release/scripts/ryu/PON_topology_100_flow_add_then_delete_us_then_ds.py
new file mode 100644
index 0000000..188208f
--- /dev/null
+++ b/bal_release/scripts/ryu/PON_topology_100_flow_add_then_delete_us_then_ds.py
@@ -0,0 +1,119 @@
+# Copyright (C) 2011 Nippon Telegraph and Telephone Corporation.

+#

+# 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

+

+from ryu.base import app_manager

+from time import sleep

+from ryu.controller import ofp_event

+from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER

+from ryu.controller.handler import set_ev_cls

+from ryu.ofproto import ofproto_v1_3

+from ryu.lib.packet import packet

+from ryu.lib.packet import ethernet

+from ryu.lib import addrconv

+

+LOG = logging.getLogger('ryu.app.pon_topology')

+

+class PonTopology13(app_manager.RyuApp):

+    OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]

+

+    def __init__(self, *args, **kwargs):

+        super(PonTopology13, self).__init__(*args, **kwargs)

+        self.mac_to_port = {}

+

+    @set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)

+    def switch_features_handler(self, ev):

+        datapath = ev.msg.datapath

+

+        # This does nothing if flows have not been previously configured in the OF agent

+        self.del_all_flows(datapath)

+

+        # Configure the flows (VID 100)

+        #

+        # Ports 1-128 are implicitly mapped to UNI-0 on ONU 1->128

+        # Ports 129 and above are implicitly mapped to OLT NNI-0 and above

+        self.add_vid_flow(datapath,10000, 1, 129, 100, 0)

+        self.add_vid_flow(datapath,10001, 129, 1, 100, 0)

+

+        sleep(1)

+        self.send_barrier(datapath)

+

+        sleep(5)

+        

+        # Delete the upstream flow

+        self.del_flow(datapath, 10000)

+        # Then delete the downstream flow

+        self.del_flow(datapath, 10001)

+

+    @set_ev_cls(ofp_event.EventOFPPortStatus, MAIN_DISPATCHER)

+    def port_status_handler(self, ev):

+        LOG.debug('port_status_handler port id: %d', ev.msg.desc.port_no)

+

+    def add_meter(self, datapath, meter_id, rate):

+        ofproto = datapath.ofproto

+        parser = datapath.ofproto_parser

+        band = parser.OFPMeterBandDrop(burst_size=0, rate=rate)

+        mod = parser.OFPMeterMod(datapath=datapath,

+                                 command=ofproto.OFPMC_ADD, 

+                                 flags=ofproto.OFPMF_KBPS, 

+                                 meter_id=meter_id, 

+                                 bands=[band])

+        LOG.info("add_meter: meter_id=%d, rate=%d KBPS")

+        datapath.send_msg(mod)

+

+    def add_vid_flow(self, datapath, cookie, src_port, dst_port, vid, meter_id):

+        ofproto = datapath.ofproto

+        parser = datapath.ofproto_parser

+        actions = [parser.OFPActionOutput(dst_port)]

+        if meter_id != 0:

+            inst = [parser.OFPInstructionActions(ofproto.OFPIT_APPLY_ACTIONS,actions), parser.OFPInstructionMeter(meter_id)]

+        else:

+            inst = [parser.OFPInstructionActions(ofproto.OFPIT_APPLY_ACTIONS,actions)]

+

+        # NOTE: 0x1000 is OR'd into the vid to set the OFPVID_PRESENT flag in the OpenFlow FLOW_MOD (OFPFC_ADD) 

+        # message match field.

+        match = parser.OFPMatch(in_port=src_port, vlan_vid=(vid | 0x1000))

+        mod = parser.OFPFlowMod(datapath=datapath,

+                                cookie=cookie, 

+                                cookie_mask=32767, 

+                                priority=0, 

+                                match=match, 

+                                instructions=inst)

+        LOG.info("add_vid_flow: src_port=%d dst_port=%d vid=%d meter=%d cookie=%d", 

+                 src_port, dst_port, vid, meter_id, cookie)

+        datapath.send_msg(mod)

+

+    def del_flow(self, datapath, cookie):

+        LOG.info("del_flow: cookie=%d", cookie)

+        self._del_flow(datapath, cookie, 32767)

+

+    def del_all_flows(self, datapath):

+        LOG.info("del_all_flows")

+        # Cookie 0 (argument 2) tells the OF agent to delete all configured flows

+        self._del_flow(datapath, 0, 0)

+

+    def _del_flow(self, datapath, cookie, mask):

+        ofproto = datapath.ofproto

+        parser = datapath.ofproto_parser

+ 

+        mod = parser.OFPFlowMod(

+            datapath=datapath, match=None, cookie=cookie, cookie_mask=mask,

+            command=ofproto.OFPFC_DELETE)

+        datapath.send_msg(mod)

+

+    def send_barrier(self, datapath):

+        LOG.info("send_barrier")

+        datapath.send_barrier()

+                   

diff --git a/bal_release/scripts/ryu/PON_topology_100_flow_add_with_ds_meter.py b/bal_release/scripts/ryu/PON_topology_100_flow_add_with_ds_meter.py
new file mode 100644
index 0000000..6b73d17
--- /dev/null
+++ b/bal_release/scripts/ryu/PON_topology_100_flow_add_with_ds_meter.py
@@ -0,0 +1,125 @@
+# Copyright (C) 2011 Nippon Telegraph and Telephone Corporation.

+#

+# 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

+

+from ryu.base import app_manager

+from time import sleep

+from ryu.controller import ofp_event

+from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER

+from ryu.controller.handler import set_ev_cls

+from ryu.ofproto import ofproto_v1_3

+from ryu.lib.packet import packet

+from ryu.lib.packet import ethernet

+from ryu.lib import addrconv

+

+LOG = logging.getLogger('ryu.app.pon_topology')

+

+class PonTopology13(app_manager.RyuApp):

+    OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]

+

+    def __init__(self, *args, **kwargs):

+        super(PonTopology13, self).__init__(*args, **kwargs)

+        self.mac_to_port = {}

+

+    @set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)

+    def switch_features_handler(self, ev):

+        datapath = ev.msg.datapath

+        

+        # This does nothing if flows have not been previously configured in the OF agent

+        self.del_all_flows(datapath)

+        

+        # Add a meter (500 Kbps rate limit) with an ID of 11

+        self.add_meter(datapath, 11, 500)

+ 

+        # Configure the flows  (VID 100) 

+        # Note: the downstream flow has a meter ID reference

+        #

+        # Ports 1-128 are implicitly mapped to UNI-0 on ONUs 1->128

+        # Ports 129 and above are implicitly mapped to OLT NNI-0 and above

+        self.add_vid_flow(datapath,10000, 1, 129, 100, 0)

+        self.add_vid_flow(datapath,10001, 129, 1, 100, 11)

+

+        sleep(1)

+        self.send_barrier(datapath)

+

+

+    @set_ev_cls(ofp_event.EventOFPPortStatus, MAIN_DISPATCHER)

+    def port_status_handler(self, ev):

+        LOG.debug('port_status_handler port id: %d', ev.msg.desc.port_no)

+

+    def add_meter(self, datapath, meter_id, rate):

+        ofproto = datapath.ofproto

+        parser = datapath.ofproto_parser

+        band = parser.OFPMeterBandDrop(burst_size=0, rate=rate)

+        mod = parser.OFPMeterMod(datapath=datapath,command=ofproto.OFPMC_ADD, flags=ofproto.OFPMF_KBPS, meter_id=meter_id, bands=[band])

+        LOG.info("add_meter: meter_id=%d, rate=%d KBPS")

+        datapath.send_msg(mod)

+

+    def add_vid_flow(self, datapath, cookie, src_port, dst_port, vid, meter_id):

+        ofproto = datapath.ofproto

+        parser = datapath.ofproto_parser

+        actions = [parser.OFPActionOutput(dst_port)]

+        if meter_id != 0:

+            inst = [parser.OFPInstructionActions(ofproto.OFPIT_APPLY_ACTIONS,actions), parser.OFPInstructionMeter(meter_id)]

+        else:

+            inst = [parser.OFPInstructionActions(ofproto.OFPIT_APPLY_ACTIONS,actions)]

+

+        # NOTE: 0x1000 is OR'd into the vid to set the OFPVID_PRESENT flag in the OpenFlow FLOW_MOD (OFPFC_ADD) 

+        # message match field.

+        match = parser.OFPMatch(in_port=src_port, vlan_vid=(vid | 0x1000))

+        mod = parser.OFPFlowMod(datapath=datapath,

+                                cookie=cookie, 

+                                cookie_mask=32767, 

+                                priority=0, 

+                                match=match, 

+                                instructions=inst)

+        LOG.info("add_vid_flow: src_port=%d dst_port=%d vid=%d meter=%d cookie=%d", 

+                 src_port, dst_port, vid, meter_id, cookie)

+        datapath.send_msg(mod)

+

+    def del_flow(self, datapath, cookie):

+        ofproto = datapath.ofproto

+        parser = datapath.ofproto_parser

+ 

+        mod = parser.OFPFlowMod(

+            datapath=datapath, match=None, cookie=cookie, cookie_mask=32767,

+            command=ofproto.OFPFC_DELETE)

+        LOG.info("del_flow: cookie=%d", cookie)

+        datapath.send_msg(mod)

+

+    def del_all_flows(self, datapath):

+        LOG.info("del_all_flows")

+        # Cookie 0 (argument 2) tells the OF agent to delete all configured flows

+        self._del_flow(datapath, 0, 0)

+

+    def _del_flow(self, datapath, cookie, mask):

+        ofproto = datapath.ofproto

+        parser = datapath.ofproto_parser

+ 

+        mod = parser.OFPFlowMod(datapath=datapath, 

+                                match=None, 

+                                cookie=cookie, 

+                                cookie_mask=mask,

+                                command=ofproto.OFPFC_DELETE)

+        datapath.send_msg(mod)

+

+    def send_barrier(self, datapath):

+        LOG.info("send_barrier")

+        datapath.send_barrier()

+                   

+

+

+

+                   

diff --git a/bal_release/scripts/trx_init.sh b/bal_release/scripts/trx_init.sh
new file mode 100644
index 0000000..880bff6
--- /dev/null
+++ b/bal_release/scripts/trx_init.sh
@@ -0,0 +1,67 @@
+###############################################################################
+#
+#  <:copyright-BRCM:2016:proprietary:standard
+#   
+#     Broadcom Ltd. Proprietary and Confidential.(c) 2016 Broadcom Ltd.
+#     All Rights Reserved
+#   
+#  This program is the proprietary software of Broadcom Ltd. and/or its
+#  licensors, and may only be used, duplicated, modified or distributed pursuant
+#  to the terms and conditions of a separate, written license agreement executed
+#  between you and Broadcom Ltd. (an "Authorized License").  Except as set forth in
+#  an Authorized License, Broadcom Ltd. grants no license (express or implied), right
+#  to use, or waiver of any kind with respect to the Software, and Broadcom Ltd.
+#  expressly reserves all rights in and to the Software and all intellectual
+#  property rights therein.  IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU HAVE
+#  NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY NOTIFY
+#  BROADCOM LTD AND DISCONTINUE ALL USE OF THE SOFTWARE.
+#   
+#  Except as expressly set forth in the Authorized License,
+#   
+#  1. This program, including its structure, sequence and organization,
+#      constitutes the valuable trade secrets of Broadcom Ltd., and you shall use
+#      all reasonable efforts to protect the confidentiality thereof, and to
+#      use this information only in connection with your use of Broadcom Ltd.
+#      integrated circuit products.
+#   
+#  2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
+#      AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR
+#      WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
+#      RESPECT TO THE SOFTWARE.  BROADCOM SPECIFICALLY DISCLAIMS ANY AND
+#      ALL IMPLIED WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT,
+#      FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR
+#      COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE
+#      TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF USE OR
+#      PERFORMANCE OF THE SOFTWARE.
+#   
+#  3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR
+#      ITS LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL,
+#      INDIRECT, OR EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY
+#      WAY RELATING TO YOUR USE OF OR INABILITY TO USE THE SOFTWARE EVEN
+#      IF BROADCOM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES;
+#      OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT ACTUALLY PAID FOR THE
+#      SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE LIMITATIONS
+#      SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF ANY
+#      LIMITED REMEDY.
+#  :>
+#
+###############################################################################
+ 
+# Commands required to enable all 16 PON ports on the MAPLE device
+
+/board/trx_enable pon_id=0
+/board/trx_enable pon_id=1
+/board/trx_enable pon_id=2
+/board/trx_enable pon_id=3
+/board/trx_enable pon_id=4
+/board/trx_enable pon_id=5
+/board/trx_enable pon_id=6
+/board/trx_enable pon_id=7
+/board/trx_enable pon_id=8
+/board/trx_enable pon_id=9
+/board/trx_enable pon_id=10
+/board/trx_enable pon_id=11
+/board/trx_enable pon_id=12
+/board/trx_enable pon_id=13
+/board/trx_enable pon_id=14
+/board/trx_enable pon_id=15
diff --git a/bal_release/scripts/upgrade_bal_qumran.sh b/bal_release/scripts/upgrade_bal_qumran.sh
new file mode 100755
index 0000000..8b8b61d
--- /dev/null
+++ b/bal_release/scripts/upgrade_bal_qumran.sh
@@ -0,0 +1,96 @@
+#!/bin/bash 
+
+# Define all BAL apps to be upgraded here
+FILELIST=('bcm.user' 'linux-kernel-bde.ko' 'linux-user-bde.ko' 'bcm88470_board.soc' 'combo28_dram.soc' 'config.bcm' 'init.sh' 'qax.soc' 'rc.soc')
+#JENKINSSERVER='jenkins-tlva-06.il.broadcom.com'
+JENKINSSERVER='10.187.130.172'
+ING_SDK_VER='6.5.6'
+
+mkdir -p old
+
+JENKINSPATH1="http://${JENKINSSERVER}/job/Bal.Synced.bcm-sdk-${ING_SDK_VER}/lastSuccessfulBuild/artifact/bal/cur/"
+JENKINSFILE1=(
+		'3rdparty/bcm-sdk/build/sdk-all-'${ING_SDK_VER}'/build/linux/user/wrx-3_7/bcm.user'
+        	'3rdparty/bcm-sdk/build/sdk-all-'${ING_SDK_VER}'/build/linux/user/wrx-3_7/linux-kernel-bde.ko'
+        	'3rdparty/bcm-sdk/build/sdk-all-'${ING_SDK_VER}'/build/linux/user/wrx-3_7/linux-user-bde.ko'
+        	'3rdparty/bcm-sdk/rc/qax/bcm88470_board.soc'
+		'3rdparty/bcm-sdk/rc/qax/combo28_dram.soc'
+		'3rdparty/bcm-sdk/rc/qax/config.bcm'
+		'3rdparty/bcm-sdk/rc/qax/init.sh'
+		'3rdparty/bcm-sdk/rc/qax/qax.soc'
+		'3rdparty/bcm-sdk/rc/qax/rc.soc'
+)
+
+
+function coloredEcho(){
+    local exp=$1;
+    local color=$2;
+    if ! [[ $color =~ '^[0-9]$' ]] ; then
+       case $(echo $color | tr '[:upper:]' '[:lower:]') in
+        black) color=0 ;;
+        red) color=1 ;;
+        green) color=2 ;;
+        yellow) color=3 ;;
+        blue) color=4 ;;
+        magenta) color=5 ;;
+        cyan) color=6 ;;
+        white|*) color=7 ;; # white or invalid color
+       esac
+    fi
+    tput setaf $color;
+    echo $exp;
+    tput sgr0;
+}
+
+function check_return(){
+	echo -n "$1...	"
+	$($2)
+	if [ $? -eq 0 ]; then
+		coloredEcho '[ OK ]' green
+	else
+		coloredEcho '[ ERROR ]' red
+	fi
+}
+
+# Checking connectivity to Jenkins Server
+echo -n "Verifing Connectivity to Jenkins...	"
+ping -c 1 ${JENKINSSERVER} &> /dev/null
+if [ $? -eq 0 ]; then
+		coloredEcho '[ OK ]' green
+	else
+		coloredEcho '[ ERROR ]' red
+		echo 'Aborting Upgrade!'
+		exit 0
+	fi
+
+# delete any old versions
+echo 'Deleting older versions...'
+for FILE in ${FILELIST[@]}
+	do
+		check_return "Deleting ${FILE}.old" "rm -f old/${FILE}.old"
+	done
+
+# rename the existing versions
+echo 'Renaming last version x.old ...'
+for FILE in ${FILELIST[@]}
+	do
+		check_return "Moving ${FILE} to ${FILE}.old" "mv ${FILE} old/${FILE}.old"
+	done
+
+# Get the new versions
+echo 'Downloading ING version '${ING_SDK_VER}'...'
+for FILE in ${JENKINSFILE1[@]}
+	do
+		COMMAND="wget -q ${JENKINSPATH1}${FILE}"
+		SHORTFILE=$(echo ${FILE} | sed 's:.*/::')
+		check_return "Getting Latest ${SHORTFILE}" "${COMMAND}"
+	done
+
+# Changing permissions to executable
+echo 'Changing permissions to executable...'
+for FILE in ${FILELIST[@]}
+	do
+		check_return "Makiing ${FILE} executable" "chmod 755 ${FILE}"
+	done
+
+echo 'Upgrade Complete'