Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Overview
  2. Producer
  3. Consumer
  4. Repository
  5. Data Model
  6. Searching in NOCLook
  7. Indexed properties
  8. REST API
  9. Backup and Restore
  10. Links
  11. How to set up a NI suite

...

All property values above is also indexed under the index key all in all indexes. For example in the search index you can query the all-key for both name, description, ip_addresses, as_number and hostname.

Anchor
rest
rest

REST API

Only L2VPN services are set up in this way.

NOCLook REST API is driven by django-tastypie. Authentication is set per user as an API key.

Create a new L2VPN service

Using curl
Code Block

curl -H "Authorization: ApiKey username:api_key" -H "Content-Type: application/json" -X POST --data '{"end_points": [{"equipment": "se-tug.nordu.net", "port":"l2vpn_test_port"}, {"equipment": "se-fre.nordu.net", "port":"l2vpn_test_port"}]}' https://nidev-consumer.nordu.net/api/v1/l2vpn/

Return:
{
    "created": "2012-10-08T14:13:52.711006",
    "creator": "/api/v1/user/1/",
    "description": "",
    "handle_id": 11099,
    "l2vpn_id": 1,
    "modified": "2012-10-08T14:13:52.711090",
    "modifier": "/api/v1/user/1/",
    "node": {
        "description": "",
        "handle_id": 11099,
        "l2vpn_id": 1,
        "name": "NU-S000206",
        "node_type": "Service",
        "operational_state": "Reserved",
        "service_class": "MPLS",
        "service_type": "L2VPN"
    },
    "node_id": 9245,
    "node_meta_type": "logical",
    "node_name": "NU-S000206",
    "node_type": "/api/v1/node_type/service/",
    "operational_state": "Reserved",
    "relationships": [
        "/api/v1/relationship/32129/",
        "/api/v1/relationship/32130/",
        "/api/v1/relationship/32131/"
    ],
    "resource_uri": "/api/v1/l2vpn/NU-S000206/",
    "service_type": "L2VPN"
}

Setting L2VPN service attributes

Only operational_status and description can be set for L2VPN services until more is needed.

Using curl
Code Block

curl -H "Authorization: ApiKey username:api_key" -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-S000206/

Return:
{
    "created": "2012-10-08T14:13:52.711006", 
    "creator": "/api/v1/user/1/", 
    "description": "Test REST API call l2vpn", 
    "handle_id": 11099, 
    "l2vpn_id": 1, 
    "modified": "2012-10-08T14:32:38.686338", 
    "modifier": "/api/v1/user/1/", 
    "node": {
        "description": "Test REST API call l2vpn", 
        "handle_id": 11099, 
        "l2vpn_id": 1, 
        "name": "NU-S000206", 
        "node_type": "Service", 
        "operational_state": "In service", 
        "service_class": "MPLS", 
        "service_type": "L2VPN"
    }, 
    "node_id": 9245, 
    "node_meta_type": "logical", 
    "node_name": "NU-S000206", 
    "node_type": "/api/v1/node_type/service/", 
    "operational_state": "In service", 
    "relationships": [
        "/api/v1/relationship/32129/", 
        "/api/v1/relationship/32130/", 
        "/api/v1/relationship/32131/"
    ], 
    "resource_uri": "/api/v1/l2vpn/NU-S000206/"
}

Anchor
backuprestore
backuprestore

...