[Goldeneye] BGPLS scripts
Change-Id: I1c263f5dc5b36c776c32f959278b88c848d46a9f
diff --git a/TestON/tests/FUNC/FUNCbgpls/dependencies/Bgpls_packets/Topo_pkts.pcap b/TestON/tests/FUNC/FUNCbgpls/dependencies/Bgpls_packets/Topo_pkts.pcap
new file mode 100755
index 0000000..2021f22
--- /dev/null
+++ b/TestON/tests/FUNC/FUNCbgpls/dependencies/Bgpls_packets/Topo_pkts.pcap
Binary files differ
diff --git a/TestON/tests/FUNC/FUNCbgpls/dependencies/Bgpls_packets/bgpls_all.pcap b/TestON/tests/FUNC/FUNCbgpls/dependencies/Bgpls_packets/bgpls_all.pcap
new file mode 100755
index 0000000..e831d22
--- /dev/null
+++ b/TestON/tests/FUNC/FUNCbgpls/dependencies/Bgpls_packets/bgpls_all.pcap
Binary files differ
diff --git a/TestON/tests/FUNC/FUNCbgpls/dependencies/Nbdata.py b/TestON/tests/FUNC/FUNCbgpls/dependencies/Nbdata.py
new file mode 100755
index 0000000..8a83748
--- /dev/null
+++ b/TestON/tests/FUNC/FUNCbgpls/dependencies/Nbdata.py
@@ -0,0 +1,80 @@
+"""**** Scripted by Antony Silvester ****** """
+import json
+from urllib import addbase
+import os
+
+
+import requests
+from requests.auth import HTTPBasicAuth
+
+
+class BgpLs:
+
+ def __init__(self):
+ self.localAs = 100
+ self.maxSession = 20
+ self.lsCapability = True
+ self.holdTime = 180
+ self.largeAsCapability = False
+ self.flowSpecCapability = 'IPV4'
+ self.flowSpecRpdCapability = False
+ self.remoteAs = 100
+ self.peerHoldTime = 120
+ self.connectMode = 'active'
+ self.bgpPeer = []
+ self.routerId = ''
+ self.peerIp = ''
+ #self.org_bgp = []
+
+ def ipValue(self,localip,remoteip):
+ self.routerId = localip
+ self.peerIp = remoteip
+ return self.routerId , self.peerIp
+
+ def DictoJson(self):
+ Dicdata = {}
+ org_bgp =[]
+ org_bgp.append({'peerIp': self.peerIp , 'remoteAs':self.remoteAs,
+ 'peerHoldTime':self.peerHoldTime , 'connectMode':self.connectMode })
+ if self.routerId != '':
+ Dicdata['routerId'] = self.routerId
+ if self.localAs != '':
+ Dicdata['localAs'] = self.localAs
+ if self.maxSession != '':
+ Dicdata['maxSession'] = self.maxSession
+ if self.lsCapability != '':
+ Dicdata['lsCapability'] = self.lsCapability
+ if self.holdTime != '':
+ Dicdata['holdTime'] = self.holdTime
+ if self.largeAsCapability != '':
+ Dicdata['largeAsCapability'] = self.largeAsCapability
+ if self.flowSpecCapability != '':
+ Dicdata['flowSpecCapability'] = self.flowSpecCapability
+ if self.flowSpecRpdCapability != '':
+ Dicdata['flowSpecRpdCapability'] = self.flowSpecRpdCapability
+ if self.bgpPeer != '':
+ Dicdata['bgpPeer'] = org_bgp
+
+ Dicdata = {'bgpapp':Dicdata}
+ Dicdata = {'org.onosproject.provider.bgp.cfg':Dicdata}
+ Dicdata = {'apps':Dicdata}
+ return json.dumps(Dicdata,indent=4)
+
+
+ def Comments(self):
+ print("**********************************************************************************\n")
+
+ def Constants(self):
+ self.Ne_id_1 = '1111.1111.0011'
+ self.Ne_id_2 = '2222.2222.0022'
+ self.Ne_id_3 = '3333.3333.0033'
+ self.Ne_id_4 = '4444.4444.0044'
+ listnum = [self.Ne_id_1,self.Ne_id_2,self.Ne_id_3,self.Ne_id_4,]
+ var = [self.peerIp]
+ return var,listnum
+
+ def apps(self):
+ self.app_bgp = 'org.onosproject.bgp'
+ self.app_bgpflow = 'org.onosproject.bgpflow'
+ self.list1 = [self.app_bgp,self.app_bgpflow]
+ return self.list1
diff --git a/TestON/tests/FUNC/FUNCbgpls/dependencies/Scapyfiles/Deletion_Node.py b/TestON/tests/FUNC/FUNCbgpls/dependencies/Scapyfiles/Deletion_Node.py
new file mode 100755
index 0000000..abd1cfc
--- /dev/null
+++ b/TestON/tests/FUNC/FUNCbgpls/dependencies/Scapyfiles/Deletion_Node.py
@@ -0,0 +1,53 @@
+#!/usr/bin/python # This is server.py file
+from scapy.all import *
+import socket # Import socket module
+import time # Import Time module
+import sys
+import os
+
+path = os.getcwd()
+sys.path.append('OnosSystemTest/TestON/tests/FUNC/FUNCbgpls/dependencies') #Setting the path for BgpLS
+from Nbdata import BgpLs
+
+obj = BgpLs()
+returnlist = obj.Constants()
+peerIp = returnlist[0][0]
+
+load_contrib('bgp')
+s = socket.socket() # Create a socket object
+host = peerIp # Get local machine name
+port = 179 # Reserve a port for your service.
+s.bind((host, port)) # Bind to the port
+pkts = rdpcap(path + "/OnosSystemTest/TestON/tests/FUNC/FUNCbgpls/dependencies/Bgpls_packets/bgpls_all.pcap")
+pkts[69][BGPOpen].bgp_id = peerIp
+
+s.listen(5) # Now wait for client connection.
+
+print("starting Connecting to ONOS peer")
+c, addr = s.accept() # Establish connection with client.
+print 'Got connection from ONOS :', addr
+c.send(str(pkts[69][BGPHeader])) # OPEN MESSAGE
+c.recv(4096)
+c.send(str(pkts[71][BGPHeader]))# KEEPALIVE MESSAGE
+c.recv(4096)
+c.send(str(pkts[72][BGPHeader])) # UPDATE MESSAGES
+c.send(str(pkts[74][BGPHeader]))
+c.send(str(pkts[71][BGPHeader]))
+
+time.sleep(10) # Waiting for 120 seconds for update message.
+
+c.send(str(pkts[298][BGPHeader]))
+c.send(str(pkts[860][BGPHeader])) # UPDATE MESSAGES with new node
+c.send(str(pkts[865][BGPHeader]))
+print ("New Node update msg sent")
+
+time.sleep(5)
+c.send(str(pkts[890][BGPHeader]))
+print ("Node Delete msg sent")
+
+
+while True:
+ c.recv(4096)
+ c.send(str(pkts[71][BGPHeader]))
+
+ # c.close() # Close the connection
diff --git a/TestON/tests/FUNC/FUNCbgpls/dependencies/Scapyfiles/Topo_discovery.py b/TestON/tests/FUNC/FUNCbgpls/dependencies/Scapyfiles/Topo_discovery.py
new file mode 100755
index 0000000..a7daf91
--- /dev/null
+++ b/TestON/tests/FUNC/FUNCbgpls/dependencies/Scapyfiles/Topo_discovery.py
@@ -0,0 +1,41 @@
+#!/usr/bin/python # This is server.py file
+from scapy.all import *
+import socket # Import socket module
+import time # Import Time module
+import sys
+import os
+
+path = os.getcwd()
+sys.path.append('OnosSystemTest/TestON/tests/FUNC/FUNCbgpls/dependencies') #Setting the path for BgpLS
+from Nbdata import BgpLs
+
+obj = BgpLs()
+returnlist = obj.Constants()
+peerIp = returnlist[0][0]
+
+load_contrib('bgp')
+s = socket.socket() # Create a socket object
+host = peerIp # Get local machine name
+port = 179 # Reserve a port for your service.
+s.bind((host, port)) # Bind to the port
+pkts = rdpcap(path + "/OnosSystemTest/TestON/tests/FUNC/FUNCbgpls/dependencies/Bgpls_packets/bgpls_all.pcap")
+pkts[69][BGPOpen].bgp_id = peerIp
+
+s.listen(5) # Now wait for client connection.
+
+print("starting Connecting to ONOS peer")
+c, addr = s.accept() # Establish connection with client.
+print 'Got connection from ONOS :', addr
+c.send(str(pkts[69][BGPHeader])) # OPEN MESSAGE
+c.recv(4096)
+c.send(str(pkts[71][BGPHeader]))# KEEPALIVE MESSAGE
+c.recv(4096)
+c.send(str(pkts[72][BGPHeader])) # UPDATE MESSAGES
+c.send(str(pkts[74][BGPHeader]))
+c.send(str(pkts[71][BGPHeader]))
+
+while True:
+ c.recv(4096)
+ c.send(str(pkts[71][BGPHeader]))
+
+ # c.close() # Close the connection
diff --git a/TestON/tests/FUNC/FUNCbgpls/dependencies/Scapyfiles/Update_Node.py b/TestON/tests/FUNC/FUNCbgpls/dependencies/Scapyfiles/Update_Node.py
new file mode 100755
index 0000000..3a40d6c
--- /dev/null
+++ b/TestON/tests/FUNC/FUNCbgpls/dependencies/Scapyfiles/Update_Node.py
@@ -0,0 +1,48 @@
+#!/usr/bin/python # This is server.py file
+from scapy.all import *
+import socket # Import socket module
+import time # Import Time module
+import sys
+import os
+
+path = os.getcwd()
+sys.path.append('OnosSystemTest/TestON/tests/FUNC/FUNCbgpls/dependencies') #Setting the path for BgpLS
+from Nbdata import BgpLs
+
+obj = BgpLs()
+returnlist = obj.Constants()
+peerIp = returnlist[0][0]
+
+load_contrib('bgp')
+s = socket.socket() # Create a socket object
+host = peerIp # Get local machine name
+port = 179 # Reserve a port for your service.
+s.bind((host, port)) # Bind to the port
+pkts = rdpcap(path + "/OnosSystemTest/TestON/tests/FUNC/FUNCbgpls/dependencies/Bgpls_packets/bgpls_all.pcap")
+pkts[69][BGPOpen].bgp_id = peerIp
+
+s.listen(5) # Now wait for client connection.
+
+print("starting Connecting to ONOS peer")
+c, addr = s.accept() # Establish connection with client.
+print 'Got connection from ONOS :', addr
+c.send(str(pkts[69][BGPHeader])) # OPEN MESSAGE
+c.recv(4096)
+c.send(str(pkts[71][BGPHeader]))# KEEPALIVE MESSAGE
+c.recv(4096)
+c.send(str(pkts[72][BGPHeader])) # UPDATE MESSAGES
+c.send(str(pkts[74][BGPHeader]))
+c.send(str(pkts[71][BGPHeader]))
+
+time.sleep(10) # Waiting for 120 seconds for update message.
+
+c.send(str(pkts[298][BGPHeader]))
+c.send(str(pkts[860][BGPHeader])) # UPDATE MESSAGES with new node
+c.send(str(pkts[865][BGPHeader]))
+print ("New Node update msg sent")
+
+while True:
+ c.recv(4096)
+ c.send(str(pkts[71][BGPHeader]))
+
+ # c.close() # Close the connection
diff --git a/TestON/tests/FUNC/FUNCbgpls/dependencies/Scapyfiles/__init__.py b/TestON/tests/FUNC/FUNCbgpls/dependencies/Scapyfiles/__init__.py
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/FUNC/FUNCbgpls/dependencies/Scapyfiles/__init__.py
diff --git a/TestON/tests/FUNC/FUNCbgpls/dependencies/__init__.py b/TestON/tests/FUNC/FUNCbgpls/dependencies/__init__.py
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/FUNC/FUNCbgpls/dependencies/__init__.py