Skip to content

Commit 018e041

Browse files
committed
README files added for Tools
1 parent 2e50caf commit 018e041

10 files changed

Lines changed: 317 additions & 10 deletions

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ Go here for [details](https://github.com/CiscoDevNet/pathman-sr/tree/master/dClo
180180
## To use with Docker
181181
Go here for [details](https://github.com/CiscoDevNet/pathman-sr/tree/master/docker)
182182

183+
## For Tools to help you get PCEP, BGP-LS and Netconf setup
184+
Go here for [details](https://github.com/CiscoDevNet/pathman-sr/tree/master/tools)
185+
183186

184187

185188

netconf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ def display_list(name=None):
495495
prog=sys.argv[0],
496496
description='Add, List and Remove nodes from ODL Netconf',
497497
version=version,
498-
epilog='Copyright (c) 2015 by Cisco Systems, Inc. All Rights Reserved'
498+
epilog='Copyright (c) 2017 by Cisco Systems, Inc. All Rights Reserved'
499499
)
500500

501501
subp = p.add_subparsers(help='commands', dest='command')

odl_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def print_netconf(name=None):
4949
prog=sys.argv[0],
5050
description='Test BGP, PCEP and Netconf output ODL Controller',
5151
version=version,
52-
epilog='Copyright (c) 2015 by Cisco Systems, Inc. All Rights Reserved'
52+
epilog='Copyright (c) 2017 by Cisco Systems, Inc. All Rights Reserved'
5353
)
5454

5555
subp = p.add_subparsers(help='commands', dest='command')

pathman_ini.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
2424
"""
2525

26-
sid_list = 'static_sids.json'
26+
sid_saves = 'static_sids.json'
2727

2828
#odl_ip = '127.0.0.1'
2929
odl_ip = '198.18.1.80'

pathman_sr.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
20161210, Niklas - ver 5.9g - Added Netconf-modules for users to add their nodes to netconf
5252
- Added static netconf mappings for users ho give up on netconf
5353
20161226, Niklas - ver 5.9h - Multi area/level fix for bgp-ls and sid bug.
54+
20170202, Niklas - ver 5.9i - Refactored sid_list to sid_saves to avoid duplicate use
5455
"""
5556
__author__ = 'niklas'
5657

@@ -67,7 +68,7 @@
6768

6869

6970
#==============================================================
70-
version = '5.9h'
71+
version = '5.9i'
7172
# Defaults overridden by pathman_ini.py
7273
odl_ip = '127.0.0.1'
7374
odl_port = '8181'
@@ -440,7 +441,7 @@ def update(node, temp_sid):
440441
# BGP Check
441442
bgp_rib = MyBGP()
442443
sid_dict = bgp_rib.get_sr_info()
443-
my_local_sids = file_to_dict(sid_list)
444+
my_local_sids = file_to_dict(sid_saves)
444445
# sid_dict = {}
445446
if len(sid_dict) > 0:
446447
for node in node_list:
@@ -1144,14 +1145,14 @@ def sort_paths(pathlist, metriclist, type):
11441145

11451146
def postUrl(url, data):
11461147
import requests
1147-
response = requests.post(url, data=data, auth = (odl_user, odl_password),headers= {'Content-Type': 'application/json'})
1148+
response = requests.post(url, data=data, auth=(odl_user, odl_password), headers={'Content-Type': 'application/json'})
11481149
# print response.text
11491150
return response.json()
11501151

11511152
def postXml(url, data):
11521153
""" post our lsp creation commands """
11531154
import requests
1154-
response = requests.post(url, data=data, auth = (odl_user, odl_password),headers= {'Content-Type': 'application/xml'})
1155+
response = requests.post(url, data=data, auth=(odl_user, odl_password), headers={'Content-Type': 'application/xml'})
11551156
# print response.text
11561157

11571158
return response.json()

set_static_sid.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
import sys
1515
import argparse
1616
from pathman_sr import LOGGING, file_to_dict, dict_to_file
17-
from pathman_ini import sid_list as sid_saves
17+
from pathman_ini import sid_saves
1818
# sid_list = 'static_sids.json'
1919

20-
version = '1.0'
20+
version = '1.1'
2121
# =====================================================
2222

2323

@@ -86,7 +86,7 @@ def del_sid():
8686
prog=sys.argv[0],
8787
description='Add, List and Remove SIDs from pathman_sr static file: "%s"' % sid_saves,
8888
version=version,
89-
epilog='Copyright (c) 2015 by Cisco Systems, Inc. All Rights Reserved'
89+
epilog='Copyright (c) 2017 by Cisco Systems, Inc. All Rights Reserved'
9090
)
9191

9292
subp = p.add_subparsers(help='commands', dest='command')

tools/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Tools
2+
3+
## Overview
4+
5+
These tools are added to help you get started with pathman_sr, and to remove some obstacle that you may be facing in your setup.
6+
7+
8+
- [ODL TEST](tools/README_odl_test.md), helps to verify current ODL setup in regards to Netconf, BGP-LS and PCEP.
9+
- [Netconf](tools/README_Netconf.md), Helps you add, list and delete nodes from your ODL controller inventory.
10+
- [Static SIDs](tools/README_static_sid.md), allow you to set static node SIDs for your routers, that pathman_sr will use.

tools/README_Netconf.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# NETCONF Tool
2+
3+
## Overview
4+
Pathman_SR originally used NETCONF to find node SIDs. (Now BGP RIB is tried first)
5+
As netconf is somewhat complex to get going, I have build a helper tool.
6+
7+
And if efforts fail, you can also add SIDs statically via the set_static_sid.py
8+
9+
## Configuration
10+
Configuration is shared with pathman_sr and is in pathman_ini.py
11+
```
12+
odl_ip = '198.18.1.80'
13+
odl_port = '8181'
14+
odl_user = 'admin'
15+
odl_password = 'admin'
16+
```
17+
18+
19+
## netconf.py cli
20+
21+
Help is available through --help
22+
```
23+
$ ./netconf.py --help
24+
usage: ./netconf.py [-h] [-v] [--controller_ip CONTROLLER_IP]
25+
[--controller_port CONTROLLER_PORT] [--user USER]
26+
[--password PASSWORD]
27+
{add,delete,list,static} ...
28+
29+
Add, List and Remove nodes from ODL Netconf
30+
31+
positional arguments:
32+
{add,delete,list,static}
33+
commands
34+
add add a node to netconf
35+
delete delete a node from netconf
36+
list list netconf nodes
37+
static add static SR ID to pathman_sr
38+
39+
optional arguments:
40+
-h, --help show this help message and exit
41+
-v, --version show program's version number and exit
42+
--controller_ip CONTROLLER_IP
43+
ODL Controller ip address
44+
--controller_port CONTROLLER_PORT
45+
ODL port
46+
--user USER ODL user
47+
--password PASSWORD ODL password
48+
49+
Copyright (c) 2015 by Cisco Systems, Inc. All Rights Reserved
50+
$
51+
```
52+
53+
### Add
54+
55+
```
56+
$ ./netconf.py add --help
57+
usage: ./netconf.py add [-h] --name NAME --address ADDRESS [--port PORT]
58+
[--device_user DEVICE_USER]
59+
[--device_password DEVICE_PASSWORD]
60+
61+
optional arguments:
62+
-h, --help show this help message and exit
63+
--name NAME name of node to add
64+
--address ADDRESS device ip address
65+
--port PORT device netconf port [830]
66+
--device_user DEVICE_USER
67+
device username [admin]
68+
--device_password DEVICE_PASSWORD
69+
device password [admin]
70+
$
71+
```
72+
73+
74+
### Delete
75+
76+
```
77+
$ ./netconf.py delete --help
78+
usage: ./netconf.py delete [-h] --name NAME
79+
80+
optional arguments:
81+
-h, --help show this help message and exit
82+
--name NAME name of node to delete
83+
84+
$
85+
```
86+
87+
### List
88+
89+
```
90+
$ ./netconf.py list --help
91+
usage: ./netconf.py list [-h] [--name NAME]
92+
93+
optional arguments:
94+
-h, --help show this help message and exit
95+
--name NAME name of node to list
96+
$
97+
```
98+
99+
### Static
100+
101+
```
102+
$ ./netconf.py static --help
103+
usage: ./netconf.py static [-h] [--name NAME] [--ip IP] [--sid SID]
104+
105+
optional arguments:
106+
-h, --help show this help message and exit
107+
--name NAME name of node
108+
--ip IP loopback ip of node
109+
--sid SID SR ID of node
110+
111+
$
112+
```
113+
114+
115+
116+
117+
### Examples for netconf:
118+
```
119+
./netconf.py list
120+
./netconf.py list —-name sjc
121+
./netconf.py add —-name alb --address 198.18.1.30
122+
./netconf.py delete --name nyc
123+
```
124+
125+
126+
127+

tools/README_odl_test.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# ODL Test
2+
3+
## Overview
4+
This is a collection of test commands to verify that your host can access ODL for bgp-linkstate, Netconf and PCEP.
5+
6+
7+
## odl_test.py
8+
9+
```
10+
$ ./odl_test.py --help
11+
[INFO] <module>: This is initializing the automation log
12+
usage: ./odl_test.py [-h] [-v] [--controller_ip CONTROLLER_IP]
13+
[--controller_port CONTROLLER_PORT] [--user USER]
14+
[--password PASSWORD]
15+
{pcep,bgp,netconf} ...
16+
17+
Test BGP, PCEP and Netconf output ODL Controller
18+
19+
positional arguments:
20+
{pcep,bgp,netconf} commands
21+
pcep print pcep output
22+
bgp print bgp output
23+
netconf list netconf nodes
24+
25+
optional arguments:
26+
-h, --help show this help message and exit
27+
-v, --version show program's version number and exit
28+
--controller_ip CONTROLLER_IP
29+
ODL Controller ip address
30+
--controller_port CONTROLLER_PORT
31+
ODL port
32+
--user USER ODL user
33+
--password PASSWORD ODL password
34+
35+
Copyright (c) 2017 by Cisco Systems, Inc. All Rights Reserved
36+
$
37+
```
38+
39+
## PCEP
40+
41+
```
42+
$ ./odl_test.py pcep --help
43+
[INFO] <module>: This is initializing the automation log
44+
usage: ./odl_test.py pcep [-h] [--address ADDRESS]
45+
46+
optional arguments:
47+
-h, --help show this help message and exit
48+
--address ADDRESS address of node to list
49+
$
50+
```
51+
52+
## BGP
53+
54+
```
55+
$ ./odl_test.py bgp --help
56+
[INFO] <module>: This is initializing the automation log
57+
usage: ./odl_test.py bgp [-h] [--name NAME] [--address ADDRESS]
58+
59+
optional arguments:
60+
-h, --help show this help message and exit
61+
--name NAME name of node to list
62+
--address ADDRESS address of node to list
63+
$
64+
```
65+
66+
## Netconf
67+
68+
```
69+
$ ./odl_test.py netconf --help
70+
[INFO] <module>: This is initializing the automation log
71+
usage: ./odl_test.py netconf [-h] [--name NAME]
72+
73+
optional arguments:
74+
-h, --help show this help message and exit
75+
--name NAME name of node to list
76+
$
77+
```
78+

0 commit comments

Comments
 (0)