<build.suffix>1.0.0</build.suffix>
<yangtools.binding.version>0.6.0-SNAPSHOT</yangtools.binding.version>
<yang.binding.version>0.6.0-SNAPSHOT</yang.binding.version>
- <yang.version>0.5.9-SNAPSHOT</yang.version>
+ <yang.version>0.6.0-SNAPSHOT</yang.version>
<yang.codegen.version>0.6.0-SNAPSHOT</yang.codegen.version>
<sonar.host.url>https://sonar.opendaylight.org/</sonar.host.url>
<sonar.branch>${user.name}-private-view</sonar.branch>
return record;
}
- public void setRecord(LocatorRecord record) {
+ public MappingServiceRLOC setRecord(LocatorRecord record) {
this.record = record;
+ return this;
}
public int getTtl() {
return ttl;
}
- public void setTtl(int ttl) {
+ public MappingServiceRLOC setTtl(int ttl) {
this.ttl = ttl;
+ return this;
}
public Action getAction() {
return action;
}
- public void setAction(Action action) {
+ public MappingServiceRLOC setAction(Action action) {
this.action = action;
+ return this;
}
public boolean isAuthoritative() {
return authoritative;
}
- public void setAuthoritative(boolean authoritative) {
+ public MappingServiceRLOC setAuthoritative(boolean authoritative) {
this.authoritative = authoritative;
+ return this;
}
public Date getRegisterdDate() {
return registerdDate;
}
- public void setRegisterdDate(Date registerdDate) {
+ public MappingServiceRLOC setRegisterdDate(Date registerdDate) {
this.registerdDate = registerdDate;
+ return this;
}
@Override
try {
this.address = InetAddress.getByAddress(byteRepresentation.array());
} catch (UnknownHostException e) {
- e.printStackTrace();
}
}
registerWithOSGIConsole();
logger.info("LISP (RFC6830) Mapping Service init finished");
} catch (Throwable t) {
- t.printStackTrace();
+ logger.error(t.getStackTrace().toString());
}
}
package org.opendaylight.lispflowmapping.implementation.lisp;
import java.util.ArrayList;
-import java.util.List;
+import java.util.Date;
+import java.util.HashMap;
import java.util.Map;
import org.apache.commons.lang3.BooleanUtils;
break;
}
}
- MappingServiceValue value = new MappingServiceValue();
+ IMappingServiceKey key = MappingServiceKeyUtil.generateMappingServiceKey(eidRecord.getLispAddressContainer(),
+ eidRecord.getMaskLength());
+ MappingServiceValue value = null;
+ Map<String, ?> locators = dao.get(key);
+ if (locators != null) {
+ value = (MappingServiceValue) locators.get("value");
+ }
+ if (value == null) {
+ value = new MappingServiceValue();
+ value.setRlocs(new ArrayList<MappingServiceRLOC>());
+ }
+ if (value.getRlocs() == null) {
+ value.setRlocs(new ArrayList<MappingServiceRLOC>());
+ }
+
MappingEntry<MappingServiceValue> entry = new MappingEntry<MappingServiceValue>("value", value);
- List<MappingServiceRLOC> rlocs = new ArrayList<MappingServiceRLOC>();
if (eidRecord.getLocatorRecord() != null) {
+ Map<LocatorRecord, MappingServiceRLOC> currentRLOCs = new HashMap<LocatorRecord, MappingServiceRLOC>();
+ for (MappingServiceRLOC msr : value.getRlocs()) {
+ currentRLOCs.put(msr.getRecord(), msr);
+ }
+
for (LocatorRecord locatorRecord : eidRecord.getLocatorRecord()) {
- rlocs.add(new MappingServiceRLOC(locatorRecord, eidRecord.getRecordTtl(), eidRecord.getAction(), eidRecord.isAuthoritative()));
+ if (currentRLOCs.containsKey(locatorRecord)) {
+ currentRLOCs.get(locatorRecord).setAction(eidRecord.getAction()).setAuthoritative(eidRecord.isAuthoritative())
+ .setRegisterdDate(new Date(System.currentTimeMillis())).setTtl(eidRecord.getRecordTtl());
+ } else {
+
+ value.getRlocs().add(
+ new MappingServiceRLOC(locatorRecord, eidRecord.getRecordTtl(), eidRecord.getAction(), eidRecord
+ .isAuthoritative()));
+ }
}
}
- value.setRlocs(rlocs);
- IMappingServiceKey key = MappingServiceKeyUtil.generateMappingServiceKey(eidRecord.getLispAddressContainer(),
- eidRecord.getMaskLength());
dao.put(key, entry);
}
import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO;
import org.opendaylight.lispflowmapping.interfaces.dao.IMappingServiceKey;
import org.opendaylight.lispflowmapping.interfaces.dao.MappingEntry;
+import org.opendaylight.lispflowmapping.interfaces.dao.MappingServiceRLOC;
import org.opendaylight.lispflowmapping.interfaces.dao.MappingServiceValue;
import org.opendaylight.lispflowmapping.tools.junit.BaseTestCase;
import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.LispAFIAddress;
assertEquals(rloc, ((MappingServiceValue) entries[0].getValue()).getRlocs().get(0).getRecord().getLispAddressContainer().getAddress());
}
+ @Test
+ public void handleMapRegister__TestOtherKeyExists() throws Exception {
+ mapRegisterBuilder.setWantMapNotify(false);
+
+ Map<String, MappingServiceValue> result = new HashMap<String, MappingServiceValue>();
+ MappingServiceValue value = new MappingServiceValue();
+ value.setRlocs(new ArrayList<MappingServiceRLOC>());
+ LocatorRecord rec = new LocatorRecordBuilder().setLispAddressContainer(LispAFIConvertor.toContainer(eid)).build();
+ MappingServiceRLOC msr = new MappingServiceRLOC(rec, 60, Action.NoAction, false);
+ value.getRlocs().add(msr);
+ result.put("value", value);
+ allowing(lispDAO)
+ .get(weq(MappingServiceKeyUtil.generateMappingServiceKey(mapRegisterBuilder.getEidToLocatorRecord().get(0).getLispAddressContainer(),
+ 32)));
+ ret(result);
+ addGetExpectations(eid, 32);
+ msr = new MappingServiceRLOC(new LocatorRecordBuilder().setLispAddressContainer(LispAFIConvertor.toContainer(rloc)).build(), 60,
+ Action.NoAction, false);
+ value.getRlocs().add(msr);
+ MappingEntry<MappingServiceValue> entry = new MappingEntry<MappingServiceValue>("value", value);
+ allowing(lispDAO).put(
+ MappingServiceKeyUtil.generateMappingServiceKey(mapRegisterBuilder.getEidToLocatorRecord().get(0).getLispAddressContainer(), 32),
+ entry);
+
+ testedMapServer.handleMapRegister(mapRegisterBuilder.build());
+
+ }
+
+ @Test
+ public void handleMapRegister__TestKeyExistsAndOther() throws Exception {
+ mapRegisterBuilder.setWantMapNotify(false);
+
+ Map<String, MappingServiceValue> result = new HashMap<String, MappingServiceValue>();
+ MappingServiceValue value = new MappingServiceValue();
+ value.setRlocs(new ArrayList<MappingServiceRLOC>());
+ LocatorRecord rec = new LocatorRecordBuilder().setLispAddressContainer(LispAFIConvertor.toContainer(eid)).build();
+ MappingServiceRLOC msr = new MappingServiceRLOC(rec, 60, Action.NoAction, false);
+ value.getRlocs().add(msr);
+ rec = new LocatorRecordBuilder().setLispAddressContainer(LispAFIConvertor.toContainer(rloc)).build();
+ msr = new MappingServiceRLOC(rec, 60, Action.NoAction, false);
+ value.getRlocs().add(msr);
+ result.put("value", value);
+ allowing(lispDAO)
+ .get(weq(MappingServiceKeyUtil.generateMappingServiceKey(mapRegisterBuilder.getEidToLocatorRecord().get(0).getLispAddressContainer(),
+ 32)));
+ ret(result);
+ addGetExpectations(eid, 32);
+ msr = new MappingServiceRLOC(new LocatorRecordBuilder().setLispAddressContainer(LispAFIConvertor.toContainer(rloc)).build(), 60,
+ Action.NoAction, false);
+ value.getRlocs().add(msr);
+ MappingEntry<MappingServiceValue> entry = new MappingEntry<MappingServiceValue>("value", value);
+ allowing(lispDAO).put(
+ MappingServiceKeyUtil.generateMappingServiceKey(mapRegisterBuilder.getEidToLocatorRecord().get(0).getLispAddressContainer(), 32),
+ entry);
+
+ testedMapServer.handleMapRegister(mapRegisterBuilder.build());
+
+ }
+
+ @Test
+ public void handleMapRegister__TestSameKeyExists() throws Exception {
+ mapRegisterBuilder.setWantMapNotify(false);
+
+ Map<String, MappingServiceValue> result = new HashMap<String, MappingServiceValue>();
+ MappingServiceValue value = new MappingServiceValue();
+ value.setRlocs(new ArrayList<MappingServiceRLOC>());
+ LocatorRecord rec = new LocatorRecordBuilder().setLispAddressContainer(LispAFIConvertor.toContainer(rloc)).build();
+ MappingServiceRLOC msr = new MappingServiceRLOC(rec, 40, Action.Drop, true);
+ value.getRlocs().add(msr);
+ result.put("value", value);
+ allowing(lispDAO)
+ .get(weq(MappingServiceKeyUtil.generateMappingServiceKey(mapRegisterBuilder.getEidToLocatorRecord().get(0).getLispAddressContainer(),
+ 32)));
+ ret(result);
+ addGetExpectations(eid, 32);
+ MappingServiceRLOC expectedMsr = new MappingServiceRLOC(rec, 60, Action.NoAction, false);
+ value = new MappingServiceValue();
+ value.setRlocs(Arrays.asList(expectedMsr));
+ MappingEntry<MappingServiceValue> entry = new MappingEntry<MappingServiceValue>("value", value);
+ allowing(lispDAO).put(
+ MappingServiceKeyUtil.generateMappingServiceKey(mapRegisterBuilder.getEidToLocatorRecord().get(0).getLispAddressContainer(), 32),
+ entry);
+
+ testedMapServer.handleMapRegister(mapRegisterBuilder.build());
+
+ }
+
@Test
public void handleMapRegisterIpv4__ValidNotifyEchoesRegister() throws Exception {
mapRegisterBuilder.getEidToLocatorRecord().add(
<build>
<pluginManagement>
<plugins>
-
+
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<artifactId>sal-binding-it</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-util</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-common-api</artifactId>
<artifactId>netconf-impl</artifactId>
<version>${netconf.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>${osgi.core.version}</version>
+ <scope>provided</scope>
+ </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>containermanager.it.implementation</artifactId>
<version>0.4.1-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>protocol-framework</artifactId>
+ </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal</artifactId>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
- <version>1.2.2</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<dependency>
<groupId>equinoxSDK381</groupId>
<artifactId>javax.servlet</artifactId>
- <version>3.0.0.v201112011016</version>
</dependency>
<dependency>
<groupId>equinoxSDK381</groupId>
<artifactId>javax.servlet.jsp</artifactId>
- <version>2.2.0.v201112011158</version>
</dependency>
<dependency>
<groupId>equinoxSDK381</groupId>
<artifactId>org.eclipse.equinox.ds</artifactId>
- <version>1.4.0.v20120522-1841</version>
</dependency>
<dependency>
<groupId>equinoxSDK381</groupId>
<artifactId>org.eclipse.equinox.util</artifactId>
- <version>1.0.400.v20120522-2049</version>
</dependency>
<dependency>
<groupId>equinoxSDK381</groupId>
<artifactId>org.eclipse.osgi</artifactId>
- <version>3.8.1.v20120830-144521</version>
</dependency>
<dependency>
<groupId>equinoxSDK381</groupId>
<artifactId>org.apache.felix.gogo.command</artifactId>
- <version>0.8.0.v201108120515</version>
</dependency>
<dependency>
<groupId>equinoxSDK381</groupId>
<artifactId>org.apache.felix.gogo.runtime</artifactId>
- <version>0.8.0.v201108120515</version>
</dependency>
<dependency>
<groupId>equinoxSDK381</groupId>
<artifactId>org.apache.felix.gogo.shell</artifactId>
- <version>0.8.0.v201110170705</version>
</dependency>
<dependency>
<groupId>equinoxSDK381</groupId>
<artifactId>org.eclipse.equinox.cm</artifactId>
- <version>1.0.400.v20120522-1841</version>
</dependency>
<dependency>
<groupId>equinoxSDK381</groupId>
<artifactId>org.eclipse.equinox.console</artifactId>
- <version>1.0.0.v20120522-1841</version>
</dependency>
<dependency>
<groupId>equinoxSDK381</groupId>
<artifactId>org.eclipse.equinox.launcher</artifactId>
- <version>1.3.0.v20120522-1813</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.dependencymanager</artifactId>
- <version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.dependencymanager.shell</artifactId>
- <version>3.0.1</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
- <version>2.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.transaction</groupId>
<artifactId>jboss-transaction-api_1.1_spec</artifactId>
- <version>1.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.fileinstall</artifactId>
- <version>3.1.6</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<dependency>
<groupId>virgomirror</groupId>
<artifactId>org.eclipse.jdt.core.compiler.batch</artifactId>
- <version>3.8.0.I20120518-2145</version>
</dependency>
<dependency>
<groupId>eclipselink</groupId>
<artifactId>javax.persistence</artifactId>
- <version>2.0.4.v201112161009</version>
</dependency>
<dependency>
<groupId>eclipselink</groupId>
<artifactId>javax.resource</artifactId>
- <version>1.5.0.v200906010428</version>
</dependency>
<dependency>
<groupId>orbit</groupId>
<artifactId>javax.activation</artifactId>
- <version>1.1.0.v201211130549</version>
</dependency>
<dependency>
<groupId>orbit</groupId>
<artifactId>javax.annotation</artifactId>
- <version>1.1.0.v201209060031</version>
</dependency>
<dependency>
<groupId>orbit</groupId>
<artifactId>javax.ejb</artifactId>
- <version>3.1.1.v201204261316</version>
</dependency>
<dependency>
<groupId>orbit</groupId>
<artifactId>javax.el</artifactId>
- <version>2.2.0.v201108011116</version>
</dependency>
<dependency>
<groupId>orbit</groupId>
<artifactId>javax.mail.glassfish</artifactId>
- <version>1.4.1.v201108011116</version>
</dependency>
<dependency>
<groupId>orbit</groupId>
<artifactId>javax.xml.rpc</artifactId>
- <version>1.1.0.v201005080400</version>
</dependency>
<dependency>
<groupId>orbit</groupId>
<artifactId>org.apache.catalina</artifactId>
- <version>7.0.32.v201211201336</version>
</dependency>
<dependency>
<groupId>orbit</groupId>
<artifactId>org.apache.catalina.ha</artifactId>
- <version>7.0.32.v201211201952</version>
</dependency>
<dependency>
<groupId>orbit</groupId>
<artifactId>org.apache.catalina.tribes</artifactId>
- <version>7.0.32.v201211201952</version>
</dependency>
<dependency>
<groupId>orbit</groupId>
<artifactId>org.apache.coyote</artifactId>
- <version>7.0.32.v201211201952</version>
</dependency>
<dependency>
<groupId>orbit</groupId>
<artifactId>org.apache.el</artifactId>
- <version>7.0.32.v201211081135</version>
</dependency>
<dependency>
<groupId>orbit</groupId>
<artifactId>org.apache.jasper</artifactId>
- <version>7.0.32.v201211201952</version>
</dependency>
<dependency>
<groupId>orbit</groupId>
<artifactId>org.apache.juli.extras</artifactId>
- <version>7.0.32.v201211081135</version>
</dependency>
<dependency>
<groupId>orbit</groupId>
<artifactId>org.apache.tomcat.api</artifactId>
- <version>7.0.32.v201211081135</version>
</dependency>
<dependency>
<groupId>orbit</groupId>
<artifactId>org.apache.tomcat.util</artifactId>
- <version>7.0.32.v201211201952</version>
</dependency>
<dependency>
<groupId>orbit</groupId>
<artifactId>javax.servlet.jsp.jstl</artifactId>
- <version>1.2.0.v201105211821</version>
</dependency>
<dependency>
<groupId>orbit</groupId>
<artifactId>javax.servlet.jsp.jstl.impl</artifactId>
- <version>1.2.0.v201210211230</version>
</dependency>
<!-- Add Pax Exam -->
<dependency>
- <exclusions>
- <exclusion> <!-- declare the exclusion here -->
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-container-native</artifactId>
- </exclusion>
- </exclusions>
+ <exclusions>
+ <exclusion> <!-- declare the exclusion here -->
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-container-native</artifactId>
+ </exclusion>
+ </exclusions>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-container-forked</artifactId>
<scope>test</scope>
- <version>${exam.version}</version>
+ <version>${exam.version}</version>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm-all</artifactId>
- <version>4.1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<dependency>
<groupId>org.aopalliance</groupId>
<artifactId>com.springsource.org.aopalliance</artifactId>
- <version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<dependency>
<groupId>org.ow2.chameleon.management</groupId>
<artifactId>chameleon-mbeans</artifactId>
- <version>1.0.0</version>
</dependency>
<!-- Jersey for JAXRS -->
<dependency>
<artifactId>sal-binding-broker-impl</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>config-netconf-connector</artifactId>
+ <version>${netconf.version}</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
- <artifactId>config-netconf-connector</artifactId>
- <version>${netconf.version}</version>
- <scope>test</scope>
+ <artifactId>config-persister-file-xml-adapter</artifactId>
+ <version>${config.version}</version>
</dependency>
<dependency>
- <groupId>org.opendaylight.controller.model</groupId>
- <artifactId>model-inventory</artifactId>
- <version>${mdsal.version}</version>
- </dependency>
+ <groupId>org.opendaylight.controller.model</groupId>
+ <artifactId>model-inventory</artifactId>
+ <version>${mdsal.version}</version>
+ </dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
- <version>3.17.1-GA</version>
</dependency>
<dependency>
- <groupId>org.opendaylight.controller.thirdparty</groupId>
- <artifactId>exificient</artifactId>
- <version>0.9.2-SNAPSHOT</version>
+ <groupId>org.opendaylight.controller.thirdparty</groupId>
+ <artifactId>exificient</artifactId>
</dependency>
<dependency>
<groupId>org.opendaylight.controller.thirdparty</groupId>
<artifactId>com.sun.jersey.jersey-servlet</artifactId>
</dependency>
-
+
<dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- <version>${jackson.version}</version>
- </dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- <version>${jackson.version}</version>
- </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>${jackson.version}</version>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml.jackson.jaxrs</groupId>
- <artifactId>jackson-jaxrs-json-provider</artifactId>
- <version>${jackson.version}</version>
- </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.jaxrs</groupId>
+ <artifactId>jackson-jaxrs-json-provider</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.jaxrs</groupId>
+ <artifactId>jackson-jaxrs-base</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.jaxrs</groupId>
- <artifactId>jackson-jaxrs-base</artifactId>
- <version>${jackson.version}</version>
- </dependency>
-
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<dependency>
<groupId>org.codehaus.jettison</groupId>
<artifactId>jettison</artifactId>
- <version>1.3.3</version>
</dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<version>0.4.1-SNAPSHOT</version>
</dependency>
<dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>forwardingrulesmanager</artifactId>
- <version>0.5.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>hosttracker</artifactId>
- <version>${hosttracker.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>topologymanager</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>forwardingrulesmanager.implementation</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>statisticsmanager</artifactId>
- <version>0.5.0-SNAPSHOT</version>
-</dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>statisticsmanager.implementation</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- </dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>forwardingrulesmanager</artifactId>
+ <version>0.5.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>hosttracker</artifactId>
+ <version>${hosttracker.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>topologymanager</artifactId>
+ <version>0.4.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>forwardingrulesmanager.implementation</artifactId>
+ <version>0.4.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>statisticsmanager</artifactId>
+ <version>0.5.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>statisticsmanager.implementation</artifactId>
+ <version>0.4.1-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>connectionmanager</artifactId>
<version>0.2.3-SNAPSHOT</version>
</dependency>
- <dependency>
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- <version>1.4.01</version>
- </dependency>
- </dependencies>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>mockito-configuration</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>xml-apis</groupId>
+ <artifactId>xml-apis</artifactId>
+ <version>1.4.01</version>
+ </dependency>
+ </dependencies>
<profiles>
<profile>
*/
package org.opendaylight.lispflowmapping.integrationtest;
-import aQute.lib.osgi.Constants;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.ops4j.pax.exam.CoreOptions.junitBundles;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.systemPackages;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
import java.io.BufferedReader;
import java.io.IOException;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
-import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.util.Filter;
import org.ops4j.pax.exam.util.PathUtils;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.ops4j.pax.exam.CoreOptions.junitBundles;
-import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
-import static org.ops4j.pax.exam.CoreOptions.options;
-import static org.ops4j.pax.exam.CoreOptions.systemPackages;
-import static org.ops4j.pax.exam.CoreOptions.systemProperty;
-
-//import org.opendaylight.lispflowmapping.interfaces.lisp.IFlowMapping;
-//import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.MapNotify;
-//import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.MapRegister;
-//import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.MapReply;
-//import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.MapRequest;
+import aQute.lib.osgi.Constants;
@RunWith(PaxExam.class)
public class MappingServiceIntegrationTest {
mavenBundle("org.apache.felix", "org.apache.felix.dependencymanager").versionAsInProject(),
mavenBundle("org.apache.felix", "org.apache.felix.dependencymanager.shell").versionAsInProject(),
+ mavenBundle("org.osgi", "org.osgi.core").versionAsInProject(),
mavenBundle("com.google.code.gson", "gson").versionAsInProject(),
mavenBundle("org.jboss.spec.javax.transaction", "jboss-transaction-api_1.1_spec").versionAsInProject(),
TestHelper.bindingIndependentSalBundles(),
TestHelper.bindingAwareSalBundles(),
TestHelper.mdSalCoreBundles(),
+ TestHelper.junitAndMockitoBundles(),
- // Specific bundles
- mavenBundle(ODL, "config-api").versionAsInProject(),
- mavenBundle(ODL, "sal-binding-api").versionAsInProject(), //
- mavenBundle(ODL, "sal-binding-config").versionAsInProject(),
- mavenBundle(ODL, "sal-binding-broker-impl").versionAsInProject(), //
- mavenBundle(ODL, "sal-common").versionAsInProject(), //
- mavenBundle(ODL, "sal-common-api").versionAsInProject(), //
- mavenBundle(ODL, "sal-common-impl").versionAsInProject(),
- mavenBundle(ODL, "sal-common-util").versionAsInProject(), //
-
- mavenBundle(YANG, "concepts").versionAsInProject(),
- mavenBundle(YANG, "yang-binding").versionAsInProject(), //
- mavenBundle(YANG, "yang-common").versionAsInProject(), //
- mavenBundle(YANG + ".model", "ietf-inet-types").versionAsInProject(),//
- mavenBundle(YANG + ".model", "ietf-yang-types").versionAsInProject(),//
- mavenBundle(YANG + ".thirdparty", "xtend-lib-osgi").versionAsInProject(),//
- mavenBundle(YANG, "yang-data-api").versionAsInProject(), //
- mavenBundle(YANG, "yang-data-impl").versionAsInProject(), //
- mavenBundle(YANG, "yang-model-api").versionAsInProject(), //
- mavenBundle(YANG, "yang-model-util").versionAsInProject(), //
- mavenBundle(YANG, "yang-parser-api").versionAsInProject(),
- mavenBundle(YANG, "yang-parser-impl").versionAsInProject(),
- mavenBundle(YANG, "binding-generator-spi").versionAsInProject(), //
- mavenBundle(YANG, "binding-model-api").versionAsInProject(), //
- mavenBundle(YANG, "binding-generator-util").versionAsInProject(),
- mavenBundle(YANG, "yang-parser-impl").versionAsInProject(),
- mavenBundle(YANG, "binding-type-provider").versionAsInProject(),
- mavenBundle(YANG, "binding-generator-api").versionAsInProject(),
- mavenBundle(YANG, "binding-generator-spi").versionAsInProject(),
- mavenBundle(YANG, "binding-generator-impl").versionAsInProject(),
- mavenBundle(YANG + ".thirdparty", "antlr4-runtime-osgi-nohead").versionAsInProject(), //
-
- mavenBundle("com.google.guava", "guava").versionAsInProject(), //
mavenBundle("org.javassist", "javassist").versionAsInProject(), //
// Northbound bundles
mavenBundle("org.opendaylight.lispflowmapping", "mappingservice.southbound").versionAsInProject(), //
mavenBundle("org.opendaylight.lispflowmapping", "mappingservice.northbound").versionAsInProject(), //
- // Additions
- mavenBundle(ODL, "sal-core-api").versionAsInProject().update(), //
- mavenBundle(ODL, "sal-core-spi").versionAsInProject().update(), //
- mavenBundle(ODL, "sal-broker-impl").versionAsInProject(), //
- mavenBundle(ODL, "sal-connector-api").versionAsInProject(), //
-
- mavenBundle(ODL, "config-api").versionAsInProject(), //
- mavenBundle(ODL, "config-manager").versionAsInProject(), //
-
junitBundles());
}
}
+ @Test
+ public void mapRegisterMapRegisterAndMapRequest() throws SocketTimeoutException {
+
+ LispIpv4Address eid = asIPAfiAddress("1.2.3.4");
+ MapRegister mb = createMapRegister(eid, asIPAfiAddress("4.3.2.1"));
+ sendMapRegister(mb);
+ MapNotify mapNotify = receiveMapNotify();
+ MapRequest mr = createMapRequest(eid);
+ sendMapRequest(mr);
+ MapReply mapReply = receiveMapReply();
+ assertEquals(mb.getEidToLocatorRecord().get(0).getLocatorRecord().get(0).getLispAddressContainer(), mapReply.getEidToLocatorRecord().get(0)
+ .getLocatorRecord().get(0).getLispAddressContainer());
+ MapRegister mb2 = createMapRegister(eid, asIPAfiAddress("4.3.2.2"));
+ sendMapRegister(mb2);
+ mapNotify = receiveMapNotify();
+ assertEquals(8, mapNotify.getNonce().longValue());
+ mr = createMapRequest(eid);
+ sendMapRequest(mr);
+ mapReply = receiveMapReply();
+ assertEquals(2, mapReply.getEidToLocatorRecord().get(0).getLocatorRecord().size());
+ assertEquals(mb.getEidToLocatorRecord().get(0).getLocatorRecord().get(0).getLispAddressContainer(), mapReply.getEidToLocatorRecord().get(0)
+ .getLocatorRecord().get(0).getLispAddressContainer());
+ assertEquals(mb2.getEidToLocatorRecord().get(0).getLocatorRecord().get(0).getLispAddressContainer(), mapReply.getEidToLocatorRecord().get(0)
+ .getLocatorRecord().get(1).getLispAddressContainer());
+ }
+
@Test
public void mapRequestMapRegisterAndMapRequestTestTimeout() throws SocketTimeoutException {
assertEquals(expectedAction, mapReply.getEidToLocatorRecord().get(0).getAction());
}
- private MapRegister createMapRegister(LispIpv4Address eid) {
+ private MapRegister createMapRegister(LispIpv4Address eid, LispIpv4Address rloc) {
MapRegisterBuilder mapRegisterbuilder = new MapRegisterBuilder();
mapRegisterbuilder.setWantMapNotify(true);
mapRegisterbuilder.setNonce((long) 8);
etlrBuilder.setMaskLength((short) 24);
etlrBuilder.setRecordTtl(254);
LocatorRecordBuilder recordBuilder = new LocatorRecordBuilder();
- recordBuilder.setLispAddressContainer(LispAFIConvertor.toContainer(asIPAfiAddress("4.3.2.1")));
+ recordBuilder.setLispAddressContainer(LispAFIConvertor.toContainer(rloc));
etlrBuilder.setLocatorRecord(new ArrayList<LocatorRecord>());
etlrBuilder.getLocatorRecord().add(recordBuilder.build());
mapRegisterbuilder.setEidToLocatorRecord(new ArrayList<EidToLocatorRecord>());
return mapRegister;
}
+ private MapRegister createMapRegister(LispIpv4Address eid) {
+ return createMapRegister(eid, asIPAfiAddress("4.3.2.1"));
+ }
+
private MapRequest createMapRequest(LispIpv4Address eid) {
MapRequestBuilder mapRequestBuilder = new MapRequestBuilder();
mapRequestBuilder.setNonce((long) 4);
logger.info("Sending MapRegister to LispPlugin on socket");
socket.send(packet);
} catch (Throwable t) {
- t.printStackTrace();
fail();
}
}
} catch (SocketTimeoutException ste) {
throw ste;
} catch (Throwable t) {
- t.printStackTrace();
fail();
return null;
}
try {
socket = new DatagramSocket(new InetSocketAddress(ourAddress, LispMessage.PORT_NUM));
} catch (SocketException e) {
- e.printStackTrace();
fail();
}
return socket;
Bundle b[] = bc.getBundles();
for (Bundle element : b) {
int state = element.getState();
- logger.debug("Bundle:" + element.getSymbolicName() + ",v" + element.getVersion() + ", state:" + stateToString(state));
+ logger.debug("Bundle[" + element.getBundleId() + "]:" + element.getSymbolicName() + ",v" + element.getVersion() + ", state:"
+ + stateToString(state));
if (state != Bundle.ACTIVE && state != Bundle.RESOLVED) {
logger.debug("Bundle:" + element.getSymbolicName() + " state:" + stateToString(state));
- // UNCOMMENT to see why bundles didn't resolve!
-
try {
String host = element.getHeaders().get(Constants.FRAGMENT_HOST);
if (host != null) {
if (debugit) {
logger.warn(("Do some debugging because some bundle is unresolved"));
}
+ // assertNotNull(broker);
int retry = 0;
ServiceReference r = null;
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
- e.printStackTrace();
}
}
retry += 1;
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
- e.printStackTrace();
}
// If LispMappingServer is null, cannot work
</encoder>
</appender>
- <root level="info">
+ <root level="warn">
<appender-ref ref="STDOUT" />
</root>
</configuration>
javax.xml.bind.annotation,
org.slf4j,
org.apache.catalina.filters,
- org.codehaus.jackson.jaxrs,
!org.codehaus.enunciate.jaxrs,
org.apache.felix.dm,
org.apache.commons.lang3.builder,
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal</artifactId>
- <version>0.7.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
try {
Thread.sleep(500);
} catch (InterruptedException e) {
- e.printStackTrace();
}
}
}