Add IPv6 default key for addkeys CLI command 86/56486/1
authorLorand Jakab <lojakab@cisco.com>
Wed, 3 May 2017 11:37:49 +0000 (14:37 +0300)
committerLorand Jakab <lojakab@cisco.com>
Wed, 3 May 2017 19:15:09 +0000 (22:15 +0300)
The addkeys Karaf CLI command adds a default authentication key
"password" of type one for the whole IPv4 EID space to ease southbound
testing. This patch extends the command to add a default authentication
key for the whole IPv6 EID space as well.

Change-Id: I93b84ab03699592cd5722f42ca63fe66437eb6d5
Signed-off-by: Lorand Jakab <lojakab@cisco.com>
mappingservice/api/src/main/java/org/opendaylight/lispflowmapping/interfaces/mappingservice/IMappingServiceShell.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/MappingServiceShell.java
mappingservice/shell/src/main/java/org/opendaylight/lispflowmapping/shell/LispAddKey.java

index 3e9be6bd222a1bedd4434fc6d6b1400d83e7417c..54dbfc068ead7aa486579c4b50c19a0a5b9e99d4 100644 (file)
@@ -40,4 +40,9 @@ public interface IMappingServiceShell {
      * Add the default key "password" for the IPv4 prefix 0.0.0.0/0.
      */
     void addDefaultKeyIPv4();
+
+    /**
+     * Add the default key "password" for the IPv6 prefix ::0/0.
+     */
+    void addDefaultKeyIPv6();
 }
index 0242910a2d068d6ee2f35f77e6b4f29deeec80f2..e1b356cea2fabda404ff318c18cd0dd05ce842e2 100644 (file)
@@ -11,6 +11,7 @@ import org.opendaylight.lispflowmapping.interfaces.mappingservice.IMappingServic
 import org.opendaylight.lispflowmapping.interfaces.mappingservice.IMappingServiceShell;
 import org.opendaylight.lispflowmapping.lisp.util.LispAddressUtil;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkeyBuilder;
@@ -53,4 +54,11 @@ public class MappingServiceShell implements IMappingServiceShell {
         MappingAuthkey key = new MappingAuthkeyBuilder().setKeyType(1).setKeyString("password").build();
         mappingService.addAuthenticationKey(eid, key);
     }
+
+    @Override
+    public void addDefaultKeyIPv6() {
+        Eid eid = LispAddressUtil.toEid(new Ipv6Prefix("::0/0"), null);
+        MappingAuthkey key = new MappingAuthkeyBuilder().setKeyType(1).setKeyString("password").build();
+        mappingService.addAuthenticationKey(eid, key);
+    }
 }
index f28db4ea5f7b2d02211259392697e0e08a4f1bfc..f47739a55ded9134d166bc70b8da18d12d4b4bf0 100644 (file)
@@ -25,6 +25,7 @@ public class LispAddKey  extends OsgiCommandSupport {
     @Override
     protected Object doExecute() throws Exception {
         mappingServiceShell.addDefaultKeyIPv4();
+        mappingServiceShell.addDefaultKeyIPv6();
         return null;
     }