From ccc17b202f7e2d356a378366fa86890ea095ec1c Mon Sep 17 00:00:00 2001
From: Erik Reid <erik.reid@geant.org>
Date: Fri, 1 Mar 2019 15:07:04 +0100
Subject: [PATCH] lookup interface info for peers

---
 README.md | 29 ++++++++++++++++++++++++++---
 1 file changed, 26 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 5e71995c..ce5bae61 100644
--- a/README.md
+++ b/README.md
@@ -374,7 +374,7 @@ Any non-empty responses are JSON formatted messages.
   The `address` parameter should be the ip address of
   a remote peer.  If this address is found in the system
   then information about the interface is returned, otherwise
-  404 is returned.
+  404 is returned (or 422 if the address can't be parsed)
 
   The response will be formatted according to the following syntax:
 
@@ -391,6 +391,13 @@ Any non-empty responses are JSON formatted messages.
                     {"pattern": r'^([a-f\d]{4}:){7}[a-f\d]{4}$'}
                 ]
             },
+            "interface-address": {
+                "type": "string",
+                "oneOf": [
+                    {"pattern": r'^(\d+\.){3}\d+/\d+$'},
+                    {"pattern": r'^[a-f\d:]+/\d+$'}
+                ]
+            },
             "vpn-rr-peer": {
                 "type": "object",
                 "properties": {
@@ -425,7 +432,19 @@ Any non-empty responses are JSON formatted messages.
                 "type": "array",
                 "items": {"$ref": "#/definitions/ip-address"}
             },
-
+            "interface-info": {
+                "type": "object",
+                "properties": {
+                    "name": {"$ref": "#/definitions/ip-address"},
+                    "interface address": {
+                        "$ref": "#/definitions/interface-address"},
+                    "interface name": {"type": "string"},
+                    "router": {"type": "string"}
+                },
+                "required": [
+                    "name", "interface address", "interface name", "router"],
+                "additionalProperties": False
+            }
         },
 
         "type": "object",
@@ -433,7 +452,11 @@ Any non-empty responses are JSON formatted messages.
             "ix-public-peer-info": {"$ref": "#/definitions/ix-public-peer"},
             "ix-public-peer-group": {
                 "$ref": "#/definitions/ix-public-peer-group"},
-            "vpn-rr-peer-info": {"$ref": "#/definitions/vpn-rr-peer"}
+            "vpn-rr-peer-info": {"$ref": "#/definitions/vpn-rr-peer"},
+            "interfaces": {
+                "type": "array",
+                "items": {"$ref": "#/definitions/interface-info"}
+            }
         },
         "additionalProperties": False
     }
-- 
GitLab