...
- Overview
- Producer
- Consumer
- Repository
- Data Model
- Searching in NOCLook
- Indexed properties
- REST API
- Backup and Restore
- Links
- How to set up a NI suiteNOCLook
- Troubleshooting
Overview
...
The only NORDUnet consumer today is NOCLook which is a web gui made with the Django web framework and Neo4j graph database as back end for the inventory data model. The data is added to the Neo4j database via norduni_client.py norduniclient which builds on neo4jneo4jdb-embeddedpython.
Repository
...
Data model
Image Removed
Hopefully these entities and relationships are enough.
See Presentation.
Image Removed
The data that was inserted manually in the prototype.
Searching in NOCLook
In addition to the search box at the top of the page you can also use the URL field for searching.
Code Block |
---|
/findall/[value]/
ex. /findall/10/
/findall/[key]/[value]/
ex. /findall/link/10/
/findin/[node type]/[value]/
ex. /findin/optical-node/10/
/findin/[node type]/[key]/[value]/
ex. /findin/optical-node/link/10/
/getall/[node type]/
ex. /getall/optical-node/
|
...
NOCLook REST API is driven by django-tastypie. Authentication is set per user as an API key.
Create a new site
Code Block |
---|
$ cat site.json
{
"node_name": "DK-AAL",
"node_type": "/api/v1/node_type/site/",
"node_meta_type": "Location",
"node": {
"address": "Selma Lagerlöfsvej 300",
"area": "Aalborg",
"country": "Denmark",
"country_code": "DK",
"latitude": "57.011944",
"longitude": "9.990560",
"owner_id": "AAU",
"postarea": "Aalborg",
"postcode": "9220"
}
}
$ curl -i -H "Authorization: ApiKey apiuser:secret" -H "Content-Type: application/json" -X POST --data @site.json |
Create a new L2VPN service
Using curl
Code Block |
---|
curl -k -H "Authorization: ApiKey usernameapiuser:api_keysecret" -H "Content-Type: application/json" -X POST --data '{"node_name": "NU-SXXXXX1", "operational_state": "In service", "route_distinguisher": "rd1", "vrf_target": "vt1", "end_points": [{"device": "se-tug.nordu.net", "port":"l2vpn_test_port"}, {"device": "se-fre.nordu.net", "port":"l2vpn_test_port"}]}' https://nidev-consumer.nordu.net/api/v1/l2vpn/
Return:
{
"created": "20122013-1002-08T1420T16:1345:5241.711006228176",
"creator": "/api/v1/user/159/",
"description": ""null,
"handle_id": 1109911717,
"l2vpn_id": 1,
"modified": "20122013-1002-08T1420T16:1345:5241.711090228213",
"modifier": "/api/v1/user/159/",
"node": {
"description": "",
"handle_id": 1109911717,
"l2vpn_id": 1,
"name": "NU-S000206SXXXXX1",
"node_type": "Service",
"operational_state": "ReservedIn service",
"service_class": "MPLS",
"service_type": "L2VPN"
},
"node_id": 924513707,
"node_meta_type": "logical",
"node_name": "NU-S000206SXXXXX1",
"node_type": "/api/v1/node_type/service/",
"object_path": "/service/11717/",
"operational_state": "ReservedIn service",
"relationships": [
"/api/v1/relationship/3212947575/",
"/api/v1/relationship/3213047576/",
"/api/v1/relationship/3213147577/"
],
"resource_uri": "/api/v1/l2vpn/NU-S000206/",11717/",
"route_distinguisher": "rd1",
"service_type": "L2VPN",
"vrf_target": "vt1"
}
|
l2vpn_id is unique for L2VPNs and should be used as base for route distinguisher and vrf target.
Setting L2VPN service attributes
...
Using curl
Code Block |
---|
curl -k -H "Authorization: ApiKey usernameapiuser:api_keysecret" -H "Content-Type: application/json" -X PUT --data '{"operational_state": "In service", "description": "Test REST API call l2vpn"}' https://nidev-consumer.nordu.net/api/v1/l2vpn/NU-S000206SXXXXX1/
Return:
{
"created": "20122013-1002-08T1420T16:1345:5241.711006228176",
"creator": "/api/v1/user/159/",
"description": "Test REST API call l2vpn",
"handle_id": 1109911717,
"l2vpn_id": 1,
"modified": "20122013-1002-08T1420T16:3251:3816.686338077192",
"modifier": "/api/v1/user/159/",
"node": {
"description": "Test REST API call l2vpn",
"handle_id": 11099,
"l2vpn_id": 111717,
"name": "NU-S000206SXXXXX1",
"node_type": "Service",
"operational_state": "In service",
"service_class": "MPLS",
"service_type": "L2VPN"
},
"node_id": 924513707,
"node_meta_type": "logical",
"node_name": "NU-S000206SXXXXX1",
"node_type": "/api/v1/node_type/service/",
"object_path": "/service/11717/",
"operational_state": "In service",
"relationships": [
"/api/v1/relationship/3212947577/",
"/api/v1/relationship/3213047576/",
"/api/v1/relationship/3213147575/"
],
"resource_uri": "/api/v1/l2vpn/NU-S000206/"
11717/",
"route_distinguisher": "rt1",
"vrf_target": "vrf1"
}
|
Anchor |
---|
| backuprestore |
---|
| backuprestore |
---|
|
...
You can backup the Postgresql and Neo4j databases using these scripts:
Code Block |
---|
# Backup the SQL database
su - postgres -c "pg_dumpalldump norduni > /var/opt/norduni/nistore/producers/noclook/sql/postgres.sql"
# Run NOCLook producer for backup purpose
cd /opt/norduni/src/scripts/
rm /opt/nistore/producers/noclook/json/*
./noclook_producer.py -O /opt/nistore/producers/noclook/json/
# Push the changes to nistore master
/usr/local/sbin/ni-push.sh -r /opt/nistore/
|
...
Code Block |
---|
|
# All producers need to be listed here with a path data or empty
[data]
juniper_conf =
nmap_services_py =
alcatel_isis =
noclook = /opt/nistore/producers/noclook/json/
nagios_checkmk =
cfengine_report = |
Code Block |
---|
sudo -u postgres psql -f /opt/nistore/producers/noclook/sql/postgres.sql postgresnorduni
noclook_consumer.py -C restore.conf -I
|
When using postgres you have to reset the autoincrementing handle_id property.
Code Block |
---|
python manage.py sqlsequencereset noclook
|
Copy output from the previous command and paste it in the dbshell.
Code Block |
---|
python manage.py dbshell
|
Now everything should be restored and ready to be updated as usual with noclook_consumer.py.
Links
https://ni.nordu.netImage Removed
http://nidev-consumer.nordu.netImage Removed (bleeding edge)
Issue tracker: https://project.nordu.net/browse/NORDUNIDEVImage Removed
Graph Gists
Version 1.0: http://portal.graphgist.org/graph_gists/bf9576c3-c7d0-450b-82fb-bd52e4038753
Version 2.0: http://gist.neo4j.org/?fe682b1dc394dd8e4421
How to set up
...
NOCLook
See Setting up a NORDUni 2.0 instance.
Anchor |
---|
| troubleshooting |
---|
| troubleshooting |
---|
|
Troubleshooting
Starting/stopping and restarting
Code Block |
---|
$ sudo service uwsgi start|stop|restart |