Bug 1791: Fix removeEid CLI command 05/11005/2
authorLorand Jakab <lojakab@cisco.com>
Wed, 10 Sep 2014 17:56:57 +0000 (20:56 +0300)
committerLorand Jakab <lojakab@cisco.com>
Wed, 10 Sep 2014 19:55:49 +0000 (22:55 +0300)
While at it, add previously undocumented 'addDefaultPassword' command to
CLI help.

Change-Id: I6d29be2127e78b11a0b2ca0bfe4abb7b3d5bf2a3
Signed-off-by: Lorand Jakab <lojakab@cisco.com>
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/LispMappingService.java
mappingservice/implementation/src/test/java/org/opendaylight/lispflowmapping/implementation/LispMappingServiceCliTest.java

index 2933199fab18f0c063fccddcf0da3da236f2b8a2..0d4f15aeca7c7d63b13f0d3902868f8b10fb7a10 100644 (file)
@@ -21,6 +21,7 @@ import org.opendaylight.controller.sal.binding.api.NotificationListener;
 import org.opendaylight.controller.sal.binding.api.NotificationService;
 import org.opendaylight.lispflowmapping.implementation.config.ConfigIni;
 import org.opendaylight.lispflowmapping.implementation.dao.MappingServiceKey;
+import org.opendaylight.lispflowmapping.implementation.dao.MappingServiceKeyUtil;
 import org.opendaylight.lispflowmapping.implementation.dao.MappingServiceNoMaskKey;
 import org.opendaylight.lispflowmapping.implementation.inventory.IAdSalLispInventoryService;
 import org.opendaylight.lispflowmapping.implementation.lisp.MapResolver;
@@ -163,7 +164,8 @@ public class LispMappingService implements CommandProvider, IFlowMapping, Bindin
     }
 
     public void _removeEid(final CommandInterpreter ci) {
-        lispDao.remove(LispAFIConvertor.asIPAfiAddress(ci.nextArgument()));
+        LispAddressContainer eid = LispAFIConvertor.getIPContainer(ci.nextArgument());
+        lispDao.remove(MappingServiceKeyUtil.generateMappingServiceKey(eid));
     }
 
     public void _dumpAll(final CommandInterpreter ci) {
@@ -204,9 +206,10 @@ public class LispMappingService implements CommandProvider, IFlowMapping, Bindin
     public String getHelp() {
         StringBuffer help = new StringBuffer();
         help.append("---LISP Mapping Service---\n");
-        help.append("\t dumpAll        - Dump all current EID -> RLOC mapping\n");
-        help.append("\t removeEid      - Remove a single LispIPv4Address Eid\n");
-        help.append("\t setShouldOverwritingRloc(true/false)      - set the map server's behaivior regarding existing RLOCs\n");
+        help.append("\t dumpAll                               - Dump all current EID -> RLOC mappings\n");
+        help.append("\t removeEid <EID>                       - Remove a single EID (/32 or /128)\n");
+        help.append("\t setShouldOverwriteRlocs <true|false>  - Set the map server's behavior regarding existing RLOCs\n");
+        help.append("\t addDefaultPassword                    - Add \"password\" as default password for IPv4 EIDs");
         return help.toString();
     }
 
index 6663f679b0ec57ffc89c8f1797c1b1b9f09a6ed2..3002b75c4388514a64a59be995d7a89df55be1c3 100644 (file)
@@ -17,6 +17,7 @@ import junitx.framework.StringAssert;
 import org.jmock.api.Invocation;
 import org.junit.Before;
 import org.junit.Test;
+import org.opendaylight.lispflowmapping.implementation.dao.MappingServiceKeyUtil;
 import org.opendaylight.lispflowmapping.implementation.util.LispAFIConvertor;
 import org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO;
 import org.opendaylight.lispflowmapping.interfaces.dao.IRowVisitor;
@@ -56,7 +57,7 @@ public class LispMappingServiceCliTest extends BaseTestCase {
     @Test
     public void remove__Basic() throws Exception {
         mockCommandInterpreter.addArgument("1.2.3.4");
-        oneOf(dao).remove(LispAFIConvertor.asIPAfiAddress("1.2.3.4"));
+        oneOf(dao).remove(MappingServiceKeyUtil.generateMappingServiceKey(LispAFIConvertor.getIPContainer("1.2.3.4")));
         testedLispMappingService._removeEid(mockCommandInterpreter);
     }