Commit c82702d3 authored by Binh Nguyen's avatar Binh Nguyen

Monitor OSPF hello for active neighbors

parent 4f2a98a4
#!/bin/bash
hn=$(hostname)
domain=$(echo $hn | awk -F'.' '{print $2"."$3"."$4"."$5}')
for i in 2 3 4
do
echo -e "\n========================="
echo "Kill FRR on node $i ..."
scp kill_frr.sh start_frr.sh node$i.$domain:~/ > /dev/null
ssh node$i.$domain "sudo ./kill_frr.sh"
done
#!/bin/bash
hn=$(hostname)
domain=$(echo $hn | awk -F'.' '{print $2"."$3"."$4"."$5}')
for i in 2 3 4
do
echo -e "\n========================="
echo "Start OSPF monitor on node $i ..."
#ssh node$i.$domain "cd ~/sripv6-linux/ospf_monitor/; nohup sudo ./start_monitor.sh 2>&1 &"
ssh node$i.$domain "cd ~/sripv6-linux/ospf_monitor/; sudo ./kill_monitor.sh"
done
echo "DONE starting OSPF monitors on all nodes!"
exit 0
#!/bin/bash
ps ax | grep main.py | grep -v grep | awk '{print $1; system("sudo kill -9 " $1)}'
......@@ -66,7 +66,7 @@ from mutils import *
import logging
LOG = logging.getLogger(__name__)
LOG.setLevel(logging.INFO)
PARSE = [0,1,1,1,1] #[hello, dbdesc, req, update, ack]
PARSE = [1,1,1,1,1] #[hello, dbdesc, req, update, ack]
#-------------------------------------------------------------------------------
......
......@@ -17,9 +17,9 @@ class LSAR(object):
print (level+1)*INDENT + json_s
def send_ospf_msg(self, ospf_msg):
uri = 'http://%s:%s/lsa_put' % (self.dst_ip, self.dst_port)
uri = 'http://%s:%s/ospf_monitor/lsa_put' % (self.dst_ip, self.dst_port)
try:
r = requests.post(uri, json=ospf_msg)
r = requests.post(uri, data=json.dumps(ospf_msg))
if (r.status_code != 200):
print "Sent OSPF message to %s,return code = %s" % (uri, r.status_code)
except:
......
......@@ -14,8 +14,8 @@ if __name__ == "__main__":
DUMP_MRTD = 0
ADDRESS = "::"
LSAA_HOST = "155.98.39.112"
LSAA_PORT = 5002
LSAA_HOST = "node1.srv6.phantomnet.emulab.net"
LSAA_PORT = 8080
#lsar = LSAR("155.98.39.112", 8080)
lsar = LSAR(LSAA_HOST, LSAA_PORT)
......@@ -31,9 +31,9 @@ if __name__ == "__main__":
while 1:
rv = ospf.parseMsg(VERBOSE, 0)
if MSG_TYPES[int(rv['T'])] == "LSUPD":
lsar.print_ospf_json(rv, VERBOSE, 0)
lsar.send_ospf_msg(rv)
if MSG_TYPES[int(rv['T'])] == "LSUPD" or MSG_TYPES[int(rv['T'])] == "HELLO":
lsar.print_ospf_json(rv, VERBOSE, 0)
lsar.send_ospf_msg(rv)
except (KeyboardInterrupt):
ospf.close()
......
#!/bin/bash
ps ax | grep main.py | grep -v grep | awk '{print $1; system("sudo kill -9 " $1)}'
sudo python main.py
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