-->
<feature version='${aaa.version}'>odl-aaa-netconf-plugin</feature>
<bundle>mvn:org.opendaylight.controller/netconf-ssh/${netconf.version}</bundle>
- <bundle>mvn:org.bouncycastle/bcpkix-jdk15on/${bouncycastle.version}</bundle>
- <bundle>mvn:org.bouncycastle/bcprov-jdk15on/${bouncycastle.version}</bundle>
</feature>
<feature name='odl-netconf-tcp' version='${netconf.version}' description="OpenDaylight :: Netconf Connector :: TCP">
<feature version='${netconf.version}'>odl-netconf-impl</feature>
<feature version='${project.version}'>odl-netconf-mapping-api</feature>
<feature version='${project.version}'>odl-netconf-util</feature>
<bundle>mvn:org.opendaylight.controller/netconf-netty-util/${project.version}</bundle>
+ <bundle>mvn:org.bouncycastle/bcpkix-jdk15on/${bouncycastle.version}</bundle>
+ <bundle>mvn:org.bouncycastle/bcprov-jdk15on/${bouncycastle.version}</bundle>
<bundle>mvn:org.apache.sshd/sshd-core/${sshd-core.version}</bundle>
<bundle>mvn:org.openexi/nagasena/${exi.nagasena.version}</bundle>
<bundle>mvn:io.netty/netty-codec/${netty.version}</bundle>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
-<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
-<stringAttribute key="M2_GOALS" value="clean org.reficio:p2-maven-plugin:site"/>
-<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
-<booleanAttribute key="M2_OFFLINE" value="false"/>
-<stringAttribute key="M2_PROFILES" value=""/>
-<listAttribute key="M2_PROPERTIES"/>
-<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>
-<booleanAttribute key="M2_SKIP_TESTS" value="false"/>
-<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
-<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="true"/>
-<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${project}"/>
-<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.m2e.launching.MavenSourceLocator"/>
-<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <sourceLookupDirector> <sourceContainers duplicates="false"/> </sourceLookupDirector> "/>
-<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
-<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
-<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx768m -XX:MaxPermSize=256m"/>
-<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/distribution.p2site}"/>
-</launchConfiguration>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
- <prerequisites>
- <maven>3.0</maven>
- </prerequisites>
-
- <!-- p2site distribution is created with the intention of providing a -->
- <!-- target platform that could be use for PDE to create an OSGi -->
- <!-- launcher, this should allow to enable the hot code replacement on -->
- <!-- the controller. -->
-
- <parent>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>commons.opendaylight</artifactId>
- <version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
- </parent>
- <scm>
- <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>
- <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
- <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:Main</url>
- </scm>
-
- <pluginRepositories>
- <pluginRepository>
- <id>reficio</id>
- <url>${nexusproxy}/repositories/reficioplugin/</url>
- </pluginRepository>
- </pluginRepositories>
-
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>distribution.p2site</artifactId>
- <version>0.2.0-SNAPSHOT</version>
- <packaging>pom</packaging>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.reficio</groupId>
- <artifactId>p2-maven-plugin</artifactId>
- <version>1.0.0</version>
- <executions>
- <execution>
- <id>default-cli</id>
- <configuration>
- <pedantic>true</pedantic>
- <artifacts>
- <artfiact>
- <id>org.slf4j:jcl-over-slf4j:${slf4j.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.slf4j:slf4j-api:${slf4j.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.slf4j:log4j-over-slf4j:${slf4j.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>ch.qos.logback:logback-core:${logback.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>ch.qos.logback:logback-classic:${logback.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.codehaus.jackson:jackson-mapper-asl:${jackson.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.codehaus.jackson:jackson-core-asl:${jackson.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.codehaus.jackson:jackson-jaxrs:${jackson.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.codehaus.jettison:jettison:1.3.3</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>commons-io:commons-io:2.4</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>commons-fileupload:commons-fileupload:1.2.2</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>equinoxSDK381:javax.servlet:3.0.0.v201112011016</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>equinoxSDK381:javax.servlet.jsp:2.2.0.v201112011158</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>equinoxSDK381:org.eclipse.equinox.ds:1.4.0.v20120522-1841</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>equinoxSDK381:org.eclipse.equinox.util:1.0.400.v20120522-2049</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>equinoxSDK381:org.eclipse.osgi.services:3.3.100.v20120522-1822</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>equinoxSDK381:org.eclipse.osgi:3.8.1.v20120830-144521</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>equinoxSDK381:org.apache.felix.gogo.command:0.8.0.v201108120515</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>equinoxSDK381:org.apache.felix.gogo.runtime:0.8.0.v201108120515</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>equinoxSDK381:org.apache.felix.gogo.shell:0.8.0.v201110170705</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>equinoxSDK381:org.eclipse.equinox.cm:1.0.400.v20120522-1841</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>equinoxSDK381:org.eclipse.equinox.console:1.0.0.v20120522-1841</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>equinoxSDK381:org.eclipse.equinox.launcher:1.3.0.v20120522-1813</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>geminiweb:org.eclipse.gemini.web.core:${geminiweb.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>geminiweb:org.eclipse.gemini.web.extender:${geminiweb.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>geminiweb:org.eclipse.gemini.web.tomcat:${geminiweb.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>geminiweb:org.eclipse.virgo.kernel.equinox.extensions:${virgo.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>geminiweb:org.eclipse.virgo.util.common:${virgo.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>geminiweb:org.eclipse.virgo.util.io:${virgo.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>geminiweb:org.eclipse.virgo.util.math:${virgo.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>geminiweb:org.eclipse.virgo.util.osgi:${virgo.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>geminiweb:org.eclipse.virgo.util.osgi.manifest:${virgo.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>geminiweb:org.eclipse.virgo.util.parser.manifest:${virgo.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.apache.felix:org.apache.felix.dependencymanager:3.1.0</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.apache.felix:org.apache.felix.dependencymanager.shell:3.0.1</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>com.google.code.gson:gson:2.1</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:1.0.1.Final</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.apache.commons:commons-lang3:3.1</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>virgomirror:org.eclipse.jdt.core.compiler.batch:3.8.0.I20120518-2145</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>eclipselink:javax.persistence:2.0.4.v201112161009</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:javax.activation:1.1.0.v201211130549</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:javax.annotation:1.1.0.v201209060031</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:javax.ejb:3.1.1.v201204261316</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:javax.el:2.2.0.v201108011116</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:javax.mail.glassfish:1.4.1.v201108011116</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:javax.xml.rpc:1.1.0.v201005080400</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:org.apache.catalina:7.0.32.v201211201336</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:org.apache.catalina.ha:7.0.32.v201211201952</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:org.apache.catalina.tribes:7.0.32.v201211201952</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:org.apache.coyote:7.0.32.v201211201952</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:org.apache.el:7.0.32.v201211081135</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:org.apache.jasper:7.0.32.v201211201952</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:org.apache.juli.extras:7.0.32.v201211081135</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:org.apache.tomcat.api:7.0.32.v201211081135</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:org.apache.tomcat.util:7.0.32.v201211201952</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:javax.servlet.jsp.jstl:1.2.0.v201105211821</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:javax.servlet.jsp.jstl.impl:1.2.0.v201210211230</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.springframework:org.springframework.asm:${spring.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.springframework:org.springframework.aop:${spring.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.springframework:org.springframework.context:${spring.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.springframework:org.springframework.context.support:${spring.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.springframework:org.springframework.core:${spring.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.springframework:org.springframework.beans:${spring.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.springframework:org.springframework.expression:${spring.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.springframework:org.springframework.web:${spring.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.aopalliance:com.springsource.org.aopalliance:1.0.0</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.springframework:org.springframework.web.servlet:${spring.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.springframework.security:spring-security-config:${spring-security.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.springframework.security:spring-security-core:${spring-security.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.springframework.security:spring-security-web:${spring-security.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.springframework.security:spring-security-taglibs:${spring-security.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.springframework:org.springframework.transaction:${spring-security.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.ow2.chameleon.management:chameleon-mbeans:1.0.0</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>com.sun.jersey:jersey-core:${jersey.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>com.sun.jersey:jersey-server:${jersey.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>com.sun.jersey:jersey-client:${jersey.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>com.sun.jersey:jersey-json:${jersey.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- </artifacts>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty-maven-plugin</artifactId>
- <version>8.1.5.v20120716</version>
- <configuration>
- <scanIntervalSeconds>10</scanIntervalSeconds>
- <webAppSourceDirectory>${basedir}/target/repository/</webAppSourceDirectory>
- <webApp>
- <contextPath>/site</contextPath>
- </webApp>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
import org.opendaylight.controller.sal.action.SwPath;
import org.opendaylight.controller.sal.core.ConstructionException;
import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.core.Node.NodeIDType;
import org.opendaylight.controller.sal.core.NodeConnector;
import org.opendaylight.controller.sal.flowprogrammer.Flow;
import org.opendaylight.controller.sal.match.Match;
Uri nodeConnector = ((OutputActionCase) sourceAction).getOutputAction().getOutputNodeConnector();
if (nodeConnector != null) {
- //for (Uri uri : nodeConnectors) {
- Uri fullNodeConnector = new Uri(node.getType()+":"+node.getID()+":"+nodeConnector.getValue());
+ // TODO: We should really have a bi-directional map from AD-SAL node types to
+ // MD-SAL node types, but lets fix that later.
+ String type = node.getType();
+ if( type.equals(NodeIDType.OPENFLOW) ){
+ type = NodeMapping.OPENFLOW_ID_PREFIX;
+ }else{
+ type = type + ":";
+ }
+ Uri fullNodeConnector = new Uri(type+node.getID()+":"+nodeConnector.getValue());
targetAction.add(new Output(fromNodeConnectorRef(fullNodeConnector, node)));
- //}
}
} else if (sourceAction instanceof PopMplsActionCase) {
// TODO: define maping
package org.opendaylight.controller.sal.compatibility.test;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.CRUDP;
import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.ETHERNET_ARP;
assertEquals("OF|1@OF|00:00:00:00:00:00:00:2a", nodeConnector.toString());
}
+ @Test
+ public void testActionFrom() throws ConstructionException {
+ // Bug 2021: Convert AD-SAL notation into MD-SAL notation before calling NodeConnector
+ Node node = new Node(NodeIDType.OPENFLOW, 42L);
+ List<Action> odActions = new ArrayList<>();
+
+ OutputActionBuilder outputActionBuilder = new OutputActionBuilder();
+ outputActionBuilder.setOutputNodeConnector(new Uri("CONTROLLER"));
+ OutputActionCaseBuilder outputActionCaseBuilder = new OutputActionCaseBuilder();
+ outputActionCaseBuilder.setOutputAction(outputActionBuilder.build());
+ odActions.add(new ActionBuilder().setAction(outputActionCaseBuilder.build()).build());
+
+ List<org.opendaylight.controller.sal.action.Action> targetAction =
+ ToSalConversionsUtils.actionFrom(odActions, node);
+ assertNotNull(targetAction);
+ assertTrue( Output.class.isInstance(targetAction.get(0)) );
+ Output targetActionOutput = (Output) targetAction.get(0);
+ NodeConnector port = targetActionOutput.getPort();
+ assertNotNull(port);
+ assertEquals(port.getType(), NodeConnectorIDType.CONTROLLER);
+ assertEquals(port.getID(), org.opendaylight.controller.sal.core.NodeConnector.SPECIALNODECONNECTORID);
+ }
+
private void checkSalMatch(org.opendaylight.controller.sal.match.Match match, MtchType mt) throws ConstructionException {
switch (mt) {
case other:
-/**ab
+/**
* Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
builder.setFlowRef(new FlowRef(identifier));
builder.setNode(new NodeRef(nodeIdent.firstIdentifierOf(Node.class)));
builder.setFlowTable(new FlowTableRef(nodeIdent.child(Table.class, tableKey)));
- builder.setTransactionUri(new Uri(provider.getNewTransactionId()));
+
+ // This method is called only when a given flow object has been
+ // removed from datastore. So FRM always needs to set strict flag
+ // into remove-flow input so that only a flow entry associated with
+ // a given flow object is removed.
+ builder.setTransactionUri(new Uri(provider.getNewTransactionId())).
+ setStrict(Boolean.TRUE);
provider.getSalFlowService().removeFlow(builder.build());
}
}
builder.setNode(new NodeRef(nodeIdent.firstIdentifierOf(Node.class)));
builder.setFlowRef(new FlowRef(identifier));
builder.setTransactionUri(new Uri(provider.getNewTransactionId()));
- builder.setUpdatedFlow((new UpdatedFlowBuilder(update)).build());
- builder.setOriginalFlow((new OriginalFlowBuilder(original)).build());
+
+ // This method is called only when a given flow object in datastore
+ // has been updated. So FRM always needs to set strict flag into
+ // update-flow input so that only a flow entry associated with
+ // a given flow object is updated.
+ builder.setUpdatedFlow((new UpdatedFlowBuilder(update)).setStrict(Boolean.TRUE).build());
+ builder.setOriginalFlow((new OriginalFlowBuilder(original)).setStrict(Boolean.TRUE).build());
provider.getSalFlowService().updateFlow(builder.build());
}
assertEquals(1, updateFlowCalls.size());
assertEquals("DOM-1", updateFlowCalls.get(0).getTransactionUri().getValue());
assertEquals(flowII, updateFlowCalls.get(0).getFlowRef().getValue());
+ assertEquals(Boolean.TRUE, updateFlowCalls.get(0).getOriginalFlow().isStrict());
+ assertEquals(Boolean.TRUE, updateFlowCalls.get(0).getUpdatedFlow().isStrict());
forwardingRulesManager.close();
}
assertEquals(1, removeFlowCalls.size());
assertEquals("DOM-1", removeFlowCalls.get(0).getTransactionUri().getValue());
assertEquals(flowII, removeFlowCalls.get(0).getFlowRef().getValue());
+ assertEquals(Boolean.TRUE, removeFlowCalls.get(0).isStrict());
forwardingRulesManager.close();
}
package org.opendaylight.controller.cluster.datastore.node.utils.serialization;
import com.google.protobuf.ByteString;
-import org.opendaylight.controller.cluster.datastore.node.utils.QNameFactory;
-import org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils;
-import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.HashSet;
import java.util.Set;
+import org.opendaylight.controller.cluster.datastore.node.utils.QNameFactory;
+import org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
public class ValueSerializer {
public static void serialize(NormalizedNodeMessages.Node.Builder builder,
QNameSerializationContext context, Object value){
builder.setType(ValueType.getSerializableType(value).ordinal());
- builder.setValue(value.toString());
+
+ if(value instanceof YangInstanceIdentifier) {
+ builder.setInstanceIdentifierValue(
+ InstanceIdentifierUtils.toSerializable((YangInstanceIdentifier) value, context));
+ } else if(value instanceof Set) {
+ Set<?> set = (Set<?>) value;
+ if (!set.isEmpty()) {
+ for (Object o : set) {
+ if (o instanceof String) {
+ builder.addBitsValue(o.toString());
+ } else {
+ throw new IllegalArgumentException("Expected value type to be Bits but was : " +
+ value.toString());
+ }
+ }
+ }
+ } else if(value instanceof byte[]){
+ builder.setBytesValue(ByteString.copyFrom((byte[]) value));
+ } else {
+ builder.setValue(value.toString());
+ }
}
public static Object deSerialize(QNameDeSerializationContext context,
public static Object deSerialize(QNameDeSerializationContext context,
NormalizedNodeMessages.PathArgumentAttribute attribute) {
+
+ if(attribute.getType() == ValueType.YANG_IDENTIFIER_TYPE.ordinal()){
+ return InstanceIdentifierUtils.fromSerializable(
+ attribute.getInstanceIdentifierValue(), context);
+ } else if(attribute.getType() == ValueType.BITS_TYPE.ordinal()){
+ return new HashSet<>(attribute.getBitsValueList());
+ } else if(attribute.getType() == ValueType.BINARY_TYPE.ordinal()){
+ return attribute.getBytesValue().toByteArray();
+ }
return deSerializeBasicTypes(attribute.getType(), attribute.getValue());
}
* <code>optional int32 type = 3;</code>
*/
int getType();
+
+ // optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;</code>
+ *
+ * <pre>
+ * Specific values
+ * </pre>
+ */
+ boolean hasInstanceIdentifierValue();
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;</code>
+ *
+ * <pre>
+ * Specific values
+ * </pre>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierValue();
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;</code>
+ *
+ * <pre>
+ * Specific values
+ * </pre>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierValueOrBuilder();
+
+ // repeated string bitsValue = 5;
+ /**
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
+ */
+ java.util.List<java.lang.String>
+ getBitsValueList();
+ /**
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
+ */
+ int getBitsValueCount();
+ /**
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
+ */
+ java.lang.String getBitsValue(int index);
+ /**
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
+ */
+ com.google.protobuf.ByteString
+ getBitsValueBytes(int index);
+
+ // optional bytes bytesValue = 6;
+ /**
+ * <code>optional bytes bytesValue = 6;</code>
+ */
+ boolean hasBytesValue();
+ /**
+ * <code>optional bytes bytesValue = 6;</code>
+ */
+ com.google.protobuf.ByteString getBytesValue();
}
/**
* Protobuf type {@code org.opendaylight.controller.mdsal.PathArgumentAttribute}
type_ = input.readInt32();
break;
}
+ case 34: {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder subBuilder = null;
+ if (((bitField0_ & 0x00000008) == 0x00000008)) {
+ subBuilder = instanceIdentifierValue_.toBuilder();
+ }
+ instanceIdentifierValue_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.PARSER, extensionRegistry);
+ if (subBuilder != null) {
+ subBuilder.mergeFrom(instanceIdentifierValue_);
+ instanceIdentifierValue_ = subBuilder.buildPartial();
+ }
+ bitField0_ |= 0x00000008;
+ break;
+ }
+ case 42: {
+ if (!((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
+ bitsValue_ = new com.google.protobuf.LazyStringArrayList();
+ mutable_bitField0_ |= 0x00000010;
+ }
+ bitsValue_.add(input.readBytes());
+ break;
+ }
+ case 50: {
+ bitField0_ |= 0x00000010;
+ bytesValue_ = input.readBytes();
+ break;
+ }
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
+ if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
+ bitsValue_ = new com.google.protobuf.UnmodifiableLazyStringList(bitsValue_);
+ }
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
return type_;
}
+ // optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;
+ public static final int INSTANCEIDENTIFIERVALUE_FIELD_NUMBER = 4;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierValue_;
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;</code>
+ *
+ * <pre>
+ * Specific values
+ * </pre>
+ */
+ public boolean hasInstanceIdentifierValue() {
+ return ((bitField0_ & 0x00000008) == 0x00000008);
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;</code>
+ *
+ * <pre>
+ * Specific values
+ * </pre>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierValue() {
+ return instanceIdentifierValue_;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;</code>
+ *
+ * <pre>
+ * Specific values
+ * </pre>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierValueOrBuilder() {
+ return instanceIdentifierValue_;
+ }
+
+ // repeated string bitsValue = 5;
+ public static final int BITSVALUE_FIELD_NUMBER = 5;
+ private com.google.protobuf.LazyStringList bitsValue_;
+ /**
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
+ */
+ public java.util.List<java.lang.String>
+ getBitsValueList() {
+ return bitsValue_;
+ }
+ /**
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
+ */
+ public int getBitsValueCount() {
+ return bitsValue_.size();
+ }
+ /**
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
+ */
+ public java.lang.String getBitsValue(int index) {
+ return bitsValue_.get(index);
+ }
+ /**
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
+ */
+ public com.google.protobuf.ByteString
+ getBitsValueBytes(int index) {
+ return bitsValue_.getByteString(index);
+ }
+
+ // optional bytes bytesValue = 6;
+ public static final int BYTESVALUE_FIELD_NUMBER = 6;
+ private com.google.protobuf.ByteString bytesValue_;
+ /**
+ * <code>optional bytes bytesValue = 6;</code>
+ */
+ public boolean hasBytesValue() {
+ return ((bitField0_ & 0x00000010) == 0x00000010);
+ }
+ /**
+ * <code>optional bytes bytesValue = 6;</code>
+ */
+ public com.google.protobuf.ByteString getBytesValue() {
+ return bytesValue_;
+ }
+
private void initFields() {
name_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance();
value_ = "";
type_ = 0;
+ instanceIdentifierValue_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ bitsValue_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+ bytesValue_ = com.google.protobuf.ByteString.EMPTY;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized != -1) return isInitialized == 1;
+ if (hasInstanceIdentifierValue()) {
+ if (!getInstanceIdentifierValue().isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ }
memoizedIsInitialized = 1;
return true;
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeInt32(3, type_);
}
+ if (((bitField0_ & 0x00000008) == 0x00000008)) {
+ output.writeMessage(4, instanceIdentifierValue_);
+ }
+ for (int i = 0; i < bitsValue_.size(); i++) {
+ output.writeBytes(5, bitsValue_.getByteString(i));
+ }
+ if (((bitField0_ & 0x00000010) == 0x00000010)) {
+ output.writeBytes(6, bytesValue_);
+ }
getUnknownFields().writeTo(output);
}
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(3, type_);
}
+ if (((bitField0_ & 0x00000008) == 0x00000008)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(4, instanceIdentifierValue_);
+ }
+ {
+ int dataSize = 0;
+ for (int i = 0; i < bitsValue_.size(); i++) {
+ dataSize += com.google.protobuf.CodedOutputStream
+ .computeBytesSizeNoTag(bitsValue_.getByteString(i));
+ }
+ size += dataSize;
+ size += 1 * getBitsValueList().size();
+ }
+ if (((bitField0_ & 0x00000010) == 0x00000010)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(6, bytesValue_);
+ }
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
getNameFieldBuilder();
+ getInstanceIdentifierValueFieldBuilder();
}
}
private static Builder create() {
bitField0_ = (bitField0_ & ~0x00000002);
type_ = 0;
bitField0_ = (bitField0_ & ~0x00000004);
+ if (instanceIdentifierValueBuilder_ == null) {
+ instanceIdentifierValue_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ } else {
+ instanceIdentifierValueBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000008);
+ bitsValue_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+ bitField0_ = (bitField0_ & ~0x00000010);
+ bytesValue_ = com.google.protobuf.ByteString.EMPTY;
+ bitField0_ = (bitField0_ & ~0x00000020);
return this;
}
to_bitField0_ |= 0x00000004;
}
result.type_ = type_;
+ if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
+ to_bitField0_ |= 0x00000008;
+ }
+ if (instanceIdentifierValueBuilder_ == null) {
+ result.instanceIdentifierValue_ = instanceIdentifierValue_;
+ } else {
+ result.instanceIdentifierValue_ = instanceIdentifierValueBuilder_.build();
+ }
+ if (((bitField0_ & 0x00000010) == 0x00000010)) {
+ bitsValue_ = new com.google.protobuf.UnmodifiableLazyStringList(
+ bitsValue_);
+ bitField0_ = (bitField0_ & ~0x00000010);
+ }
+ result.bitsValue_ = bitsValue_;
+ if (((from_bitField0_ & 0x00000020) == 0x00000020)) {
+ to_bitField0_ |= 0x00000010;
+ }
+ result.bytesValue_ = bytesValue_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
if (other.hasType()) {
setType(other.getType());
}
+ if (other.hasInstanceIdentifierValue()) {
+ mergeInstanceIdentifierValue(other.getInstanceIdentifierValue());
+ }
+ if (!other.bitsValue_.isEmpty()) {
+ if (bitsValue_.isEmpty()) {
+ bitsValue_ = other.bitsValue_;
+ bitField0_ = (bitField0_ & ~0x00000010);
+ } else {
+ ensureBitsValueIsMutable();
+ bitsValue_.addAll(other.bitsValue_);
+ }
+ onChanged();
+ }
+ if (other.hasBytesValue()) {
+ setBytesValue(other.getBytesValue());
+ }
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
+ if (hasInstanceIdentifierValue()) {
+ if (!getInstanceIdentifierValue().isInitialized()) {
+
+ return false;
+ }
+ }
return true;
}
/**
* <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
*/
- public Builder setName(
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder builderForValue) {
- if (nameBuilder_ == null) {
- name_ = builderForValue.build();
+ public Builder setName(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder builderForValue) {
+ if (nameBuilder_ == null) {
+ name_ = builderForValue.build();
+ onChanged();
+ } else {
+ nameBuilder_.setMessage(builderForValue.build());
+ }
+ bitField0_ |= 0x00000001;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+ */
+ public Builder mergeName(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName value) {
+ if (nameBuilder_ == null) {
+ if (((bitField0_ & 0x00000001) == 0x00000001) &&
+ name_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance()) {
+ name_ =
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.newBuilder(name_).mergeFrom(value).buildPartial();
+ } else {
+ name_ = value;
+ }
+ onChanged();
+ } else {
+ nameBuilder_.mergeFrom(value);
+ }
+ bitField0_ |= 0x00000001;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+ */
+ public Builder clearName() {
+ if (nameBuilder_ == null) {
+ name_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance();
+ onChanged();
+ } else {
+ nameBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000001);
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder getNameBuilder() {
+ bitField0_ |= 0x00000001;
+ onChanged();
+ return getNameFieldBuilder().getBuilder();
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder getNameOrBuilder() {
+ if (nameBuilder_ != null) {
+ return nameBuilder_.getMessageOrBuilder();
+ } else {
+ return name_;
+ }
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+ */
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder>
+ getNameFieldBuilder() {
+ if (nameBuilder_ == null) {
+ nameBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder>(
+ name_,
+ getParentForChildren(),
+ isClean());
+ name_ = null;
+ }
+ return nameBuilder_;
+ }
+
+ // optional string value = 2;
+ private java.lang.Object value_ = "";
+ /**
+ * <code>optional string value = 2;</code>
+ */
+ public boolean hasValue() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>optional string value = 2;</code>
+ */
+ public java.lang.String getValue() {
+ java.lang.Object ref = value_;
+ if (!(ref instanceof java.lang.String)) {
+ java.lang.String s = ((com.google.protobuf.ByteString) ref)
+ .toStringUtf8();
+ value_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * <code>optional string value = 2;</code>
+ */
+ public com.google.protobuf.ByteString
+ getValueBytes() {
+ java.lang.Object ref = value_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ value_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * <code>optional string value = 2;</code>
+ */
+ public Builder setValue(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000002;
+ value_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional string value = 2;</code>
+ */
+ public Builder clearValue() {
+ bitField0_ = (bitField0_ & ~0x00000002);
+ value_ = getDefaultInstance().getValue();
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional string value = 2;</code>
+ */
+ public Builder setValueBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000002;
+ value_ = value;
+ onChanged();
+ return this;
+ }
+
+ // optional int32 type = 3;
+ private int type_ ;
+ /**
+ * <code>optional int32 type = 3;</code>
+ */
+ public boolean hasType() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ /**
+ * <code>optional int32 type = 3;</code>
+ */
+ public int getType() {
+ return type_;
+ }
+ /**
+ * <code>optional int32 type = 3;</code>
+ */
+ public Builder setType(int value) {
+ bitField0_ |= 0x00000004;
+ type_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional int32 type = 3;</code>
+ */
+ public Builder clearType() {
+ bitField0_ = (bitField0_ & ~0x00000004);
+ type_ = 0;
+ onChanged();
+ return this;
+ }
+
+ // optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierValue_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> instanceIdentifierValueBuilder_;
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;</code>
+ *
+ * <pre>
+ * Specific values
+ * </pre>
+ */
+ public boolean hasInstanceIdentifierValue() {
+ return ((bitField0_ & 0x00000008) == 0x00000008);
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;</code>
+ *
+ * <pre>
+ * Specific values
+ * </pre>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierValue() {
+ if (instanceIdentifierValueBuilder_ == null) {
+ return instanceIdentifierValue_;
+ } else {
+ return instanceIdentifierValueBuilder_.getMessage();
+ }
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;</code>
+ *
+ * <pre>
+ * Specific values
+ * </pre>
+ */
+ public Builder setInstanceIdentifierValue(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+ if (instanceIdentifierValueBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ instanceIdentifierValue_ = value;
+ onChanged();
+ } else {
+ instanceIdentifierValueBuilder_.setMessage(value);
+ }
+ bitField0_ |= 0x00000008;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;</code>
+ *
+ * <pre>
+ * Specific values
+ * </pre>
+ */
+ public Builder setInstanceIdentifierValue(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) {
+ if (instanceIdentifierValueBuilder_ == null) {
+ instanceIdentifierValue_ = builderForValue.build();
onChanged();
} else {
- nameBuilder_.setMessage(builderForValue.build());
+ instanceIdentifierValueBuilder_.setMessage(builderForValue.build());
}
- bitField0_ |= 0x00000001;
+ bitField0_ |= 0x00000008;
return this;
}
/**
- * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;</code>
+ *
+ * <pre>
+ * Specific values
+ * </pre>
*/
- public Builder mergeName(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName value) {
- if (nameBuilder_ == null) {
- if (((bitField0_ & 0x00000001) == 0x00000001) &&
- name_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance()) {
- name_ =
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.newBuilder(name_).mergeFrom(value).buildPartial();
+ public Builder mergeInstanceIdentifierValue(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+ if (instanceIdentifierValueBuilder_ == null) {
+ if (((bitField0_ & 0x00000008) == 0x00000008) &&
+ instanceIdentifierValue_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()) {
+ instanceIdentifierValue_ =
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.newBuilder(instanceIdentifierValue_).mergeFrom(value).buildPartial();
} else {
- name_ = value;
+ instanceIdentifierValue_ = value;
}
onChanged();
} else {
- nameBuilder_.mergeFrom(value);
+ instanceIdentifierValueBuilder_.mergeFrom(value);
}
- bitField0_ |= 0x00000001;
+ bitField0_ |= 0x00000008;
return this;
}
/**
- * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;</code>
+ *
+ * <pre>
+ * Specific values
+ * </pre>
*/
- public Builder clearName() {
- if (nameBuilder_ == null) {
- name_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance();
+ public Builder clearInstanceIdentifierValue() {
+ if (instanceIdentifierValueBuilder_ == null) {
+ instanceIdentifierValue_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
onChanged();
} else {
- nameBuilder_.clear();
+ instanceIdentifierValueBuilder_.clear();
}
- bitField0_ = (bitField0_ & ~0x00000001);
+ bitField0_ = (bitField0_ & ~0x00000008);
return this;
}
/**
- * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;</code>
+ *
+ * <pre>
+ * Specific values
+ * </pre>
*/
- public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder getNameBuilder() {
- bitField0_ |= 0x00000001;
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder getInstanceIdentifierValueBuilder() {
+ bitField0_ |= 0x00000008;
onChanged();
- return getNameFieldBuilder().getBuilder();
+ return getInstanceIdentifierValueFieldBuilder().getBuilder();
}
/**
- * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;</code>
+ *
+ * <pre>
+ * Specific values
+ * </pre>
*/
- public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder getNameOrBuilder() {
- if (nameBuilder_ != null) {
- return nameBuilder_.getMessageOrBuilder();
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierValueOrBuilder() {
+ if (instanceIdentifierValueBuilder_ != null) {
+ return instanceIdentifierValueBuilder_.getMessageOrBuilder();
} else {
- return name_;
+ return instanceIdentifierValue_;
}
}
/**
- * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;</code>
+ *
+ * <pre>
+ * Specific values
+ * </pre>
*/
private com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder>
- getNameFieldBuilder() {
- if (nameBuilder_ == null) {
- nameBuilder_ = new com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder>(
- name_,
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
+ getInstanceIdentifierValueFieldBuilder() {
+ if (instanceIdentifierValueBuilder_ == null) {
+ instanceIdentifierValueBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>(
+ instanceIdentifierValue_,
getParentForChildren(),
isClean());
- name_ = null;
+ instanceIdentifierValue_ = null;
}
- return nameBuilder_;
+ return instanceIdentifierValueBuilder_;
}
- // optional string value = 2;
- private java.lang.Object value_ = "";
+ // repeated string bitsValue = 5;
+ private com.google.protobuf.LazyStringList bitsValue_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+ private void ensureBitsValueIsMutable() {
+ if (!((bitField0_ & 0x00000010) == 0x00000010)) {
+ bitsValue_ = new com.google.protobuf.LazyStringArrayList(bitsValue_);
+ bitField0_ |= 0x00000010;
+ }
+ }
/**
- * <code>optional string value = 2;</code>
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
*/
- public boolean hasValue() {
- return ((bitField0_ & 0x00000002) == 0x00000002);
+ public java.util.List<java.lang.String>
+ getBitsValueList() {
+ return java.util.Collections.unmodifiableList(bitsValue_);
}
/**
- * <code>optional string value = 2;</code>
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
*/
- public java.lang.String getValue() {
- java.lang.Object ref = value_;
- if (!(ref instanceof java.lang.String)) {
- java.lang.String s = ((com.google.protobuf.ByteString) ref)
- .toStringUtf8();
- value_ = s;
- return s;
- } else {
- return (java.lang.String) ref;
- }
+ public int getBitsValueCount() {
+ return bitsValue_.size();
}
/**
- * <code>optional string value = 2;</code>
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
+ */
+ public java.lang.String getBitsValue(int index) {
+ return bitsValue_.get(index);
+ }
+ /**
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
*/
public com.google.protobuf.ByteString
- getValueBytes() {
- java.lang.Object ref = value_;
- if (ref instanceof String) {
- com.google.protobuf.ByteString b =
- com.google.protobuf.ByteString.copyFromUtf8(
- (java.lang.String) ref);
- value_ = b;
- return b;
- } else {
- return (com.google.protobuf.ByteString) ref;
- }
+ getBitsValueBytes(int index) {
+ return bitsValue_.getByteString(index);
}
/**
- * <code>optional string value = 2;</code>
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
*/
- public Builder setValue(
+ public Builder setBitsValue(
+ int index, java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureBitsValueIsMutable();
+ bitsValue_.set(index, value);
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
+ */
+ public Builder addBitsValue(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
- bitField0_ |= 0x00000002;
- value_ = value;
+ ensureBitsValueIsMutable();
+ bitsValue_.add(value);
onChanged();
return this;
}
/**
- * <code>optional string value = 2;</code>
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
*/
- public Builder clearValue() {
- bitField0_ = (bitField0_ & ~0x00000002);
- value_ = getDefaultInstance().getValue();
+ public Builder addAllBitsValue(
+ java.lang.Iterable<java.lang.String> values) {
+ ensureBitsValueIsMutable();
+ super.addAll(values, bitsValue_);
onChanged();
return this;
}
/**
- * <code>optional string value = 2;</code>
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
*/
- public Builder setValueBytes(
+ public Builder clearBitsValue() {
+ bitsValue_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+ bitField0_ = (bitField0_ & ~0x00000010);
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
+ */
+ public Builder addBitsValueBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
- bitField0_ |= 0x00000002;
- value_ = value;
+ ensureBitsValueIsMutable();
+ bitsValue_.add(value);
onChanged();
return this;
}
- // optional int32 type = 3;
- private int type_ ;
+ // optional bytes bytesValue = 6;
+ private com.google.protobuf.ByteString bytesValue_ = com.google.protobuf.ByteString.EMPTY;
/**
- * <code>optional int32 type = 3;</code>
+ * <code>optional bytes bytesValue = 6;</code>
*/
- public boolean hasType() {
- return ((bitField0_ & 0x00000004) == 0x00000004);
+ public boolean hasBytesValue() {
+ return ((bitField0_ & 0x00000020) == 0x00000020);
}
/**
- * <code>optional int32 type = 3;</code>
+ * <code>optional bytes bytesValue = 6;</code>
*/
- public int getType() {
- return type_;
+ public com.google.protobuf.ByteString getBytesValue() {
+ return bytesValue_;
}
/**
- * <code>optional int32 type = 3;</code>
+ * <code>optional bytes bytesValue = 6;</code>
*/
- public Builder setType(int value) {
- bitField0_ |= 0x00000004;
- type_ = value;
+ public Builder setBytesValue(com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000020;
+ bytesValue_ = value;
onChanged();
return this;
}
/**
- * <code>optional int32 type = 3;</code>
+ * <code>optional bytes bytesValue = 6;</code>
*/
- public Builder clearType() {
- bitField0_ = (bitField0_ & ~0x00000004);
- type_ = 0;
+ public Builder clearBytesValue() {
+ bitField0_ = (bitField0_ & ~0x00000020);
+ bytesValue_ = getDefaultInstance().getBytesValue();
onChanged();
return this;
}
byte isInitialized = memoizedIsInitialized;
if (isInitialized != -1) return isInitialized == 1;
+ for (int i = 0; i < getAttributeCount(); i++) {
+ if (!getAttribute(i).isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ }
for (int i = 0; i < getAttributesCount(); i++) {
if (!getAttributes(i).isInitialized()) {
memoizedIsInitialized = 0;
}
public final boolean isInitialized() {
+ for (int i = 0; i < getAttributeCount(); i++) {
+ if (!getAttribute(i).isInitialized()) {
+
+ return false;
+ }
+ }
for (int i = 0; i < getAttributesCount(); i++) {
if (!getAttributes(i).isInitialized()) {
java.lang.String[] descriptorData = {
"\n\014Common.proto\022!org.opendaylight.control" +
"ler.mdsal\"6\n\tAttribute\022\014\n\004name\030\001 \002(\t\022\r\n\005" +
- "value\030\002 \001(\t\022\014\n\004type\030\003 \001(\t\"l\n\025PathArgumen" +
- "tAttribute\0226\n\004name\030\001 \001(\0132(.org.opendayli" +
- "ght.controller.mdsal.QName\022\r\n\005value\030\002 \001(" +
- "\t\022\014\n\004type\030\003 \001(\005\"N\n\005QName\022\r\n\005value\030\001 \001(\t\022" +
- "\021\n\tnamespace\030\002 \001(\005\022\020\n\010revision\030\003 \001(\005\022\021\n\t" +
- "localName\030\004 \001(\005\"\207\002\n\014PathArgument\022\r\n\005valu" +
- "e\030\001 \001(\t\022\014\n\004type\030\002 \001(\t\022:\n\010nodeType\030\003 \001(\0132" +
- "(.org.opendaylight.controller.mdsal.QNam",
- "e\022K\n\tattribute\030\004 \003(\01328.org.opendaylight." +
- "controller.mdsal.PathArgumentAttribute\022@" +
+ "value\030\002 \001(\t\022\014\n\004type\030\003 \001(\t\"\353\001\n\025PathArgume" +
+ "ntAttribute\0226\n\004name\030\001 \001(\0132(.org.opendayl" +
+ "ight.controller.mdsal.QName\022\r\n\005value\030\002 \001" +
+ "(\t\022\014\n\004type\030\003 \001(\005\022V\n\027instanceIdentifierVa" +
+ "lue\030\004 \001(\01325.org.opendaylight.controller." +
+ "mdsal.InstanceIdentifier\022\021\n\tbitsValue\030\005 " +
+ "\003(\t\022\022\n\nbytesValue\030\006 \001(\014\"N\n\005QName\022\r\n\005valu" +
+ "e\030\001 \001(\t\022\021\n\tnamespace\030\002 \001(\005\022\020\n\010revision\030\003",
+ " \001(\005\022\021\n\tlocalName\030\004 \001(\005\"\207\002\n\014PathArgument" +
+ "\022\r\n\005value\030\001 \001(\t\022\014\n\004type\030\002 \001(\t\022:\n\010nodeTyp" +
+ "e\030\003 \001(\0132(.org.opendaylight.controller.md" +
+ "sal.QName\022K\n\tattribute\030\004 \003(\01328.org.opend" +
+ "aylight.controller.mdsal.PathArgumentAtt" +
+ "ribute\022@\n\nattributes\030\005 \003(\0132,.org.openday" +
+ "light.controller.mdsal.Attribute\022\017\n\007intT" +
+ "ype\030\006 \001(\005\"f\n\022InstanceIdentifier\022B\n\targum" +
+ "ents\030\001 \003(\0132/.org.opendaylight.controller" +
+ ".mdsal.PathArgument\022\014\n\004code\030\002 \003(\t\"\271\003\n\004No",
+ "de\022\014\n\004path\030\001 \001(\t\022\014\n\004type\030\002 \001(\t\022E\n\014pathAr" +
+ "gument\030\003 \001(\0132/.org.opendaylight.controll" +
+ "er.mdsal.PathArgument\022\017\n\007intType\030\004 \001(\005\022@" +
"\n\nattributes\030\005 \003(\0132,.org.opendaylight.co" +
- "ntroller.mdsal.Attribute\022\017\n\007intType\030\006 \001(" +
- "\005\"f\n\022InstanceIdentifier\022B\n\targuments\030\001 \003" +
- "(\0132/.org.opendaylight.controller.mdsal.P" +
- "athArgument\022\014\n\004code\030\002 \003(\t\"\271\003\n\004Node\022\014\n\004pa" +
- "th\030\001 \001(\t\022\014\n\004type\030\002 \001(\t\022E\n\014pathArgument\030\003" +
- " \001(\0132/.org.opendaylight.controller.mdsal" +
- ".PathArgument\022\017\n\007intType\030\004 \001(\005\022@\n\nattrib",
- "utes\030\005 \003(\0132,.org.opendaylight.controller" +
- ".mdsal.Attribute\0226\n\005child\030\006 \003(\0132\'.org.op" +
- "endaylight.controller.mdsal.Node\022\r\n\005valu" +
- "e\030\007 \001(\t\022\021\n\tvalueType\030\010 \001(\t\022\024\n\014intValueTy" +
- "pe\030\t \001(\005\022V\n\027instanceIdentifierValue\030\n \001(" +
- "\01325.org.opendaylight.controller.mdsal.In" +
- "stanceIdentifier\022\021\n\tbitsValue\030\013 \003(\t\022\014\n\004c" +
- "ode\030\014 \003(\t\022\022\n\nbytesValue\030\r \001(\014\"`\n\tContain" +
- "er\022\022\n\nparentPath\030\001 \002(\t\022?\n\016normalizedNode" +
- "\030\002 \001(\0132\'.org.opendaylight.controller.mds",
- "al.Node\"\246\001\n\014NodeMapEntry\022U\n\026instanceIden" +
- "tifierPath\030\001 \002(\01325.org.opendaylight.cont" +
- "roller.mdsal.InstanceIdentifier\022?\n\016norma" +
- "lizedNode\030\002 \001(\0132\'.org.opendaylight.contr" +
- "oller.mdsal.Node\"N\n\007NodeMap\022C\n\nmapEntrie" +
- "s\030\001 \003(\0132/.org.opendaylight.controller.md" +
- "sal.NodeMapEntryBO\n5org.opendaylight.con" +
- "troller.protobuff.messages.commonB\026Norma" +
- "lizedNodeMessages"
+ "ntroller.mdsal.Attribute\0226\n\005child\030\006 \003(\0132" +
+ "\'.org.opendaylight.controller.mdsal.Node" +
+ "\022\r\n\005value\030\007 \001(\t\022\021\n\tvalueType\030\010 \001(\t\022\024\n\014in" +
+ "tValueType\030\t \001(\005\022V\n\027instanceIdentifierVa" +
+ "lue\030\n \001(\01325.org.opendaylight.controller." +
+ "mdsal.InstanceIdentifier\022\021\n\tbitsValue\030\013 ",
+ "\003(\t\022\014\n\004code\030\014 \003(\t\022\022\n\nbytesValue\030\r \001(\014\"`\n" +
+ "\tContainer\022\022\n\nparentPath\030\001 \002(\t\022?\n\016normal" +
+ "izedNode\030\002 \001(\0132\'.org.opendaylight.contro" +
+ "ller.mdsal.Node\"\246\001\n\014NodeMapEntry\022U\n\026inst" +
+ "anceIdentifierPath\030\001 \002(\01325.org.opendayli" +
+ "ght.controller.mdsal.InstanceIdentifier\022" +
+ "?\n\016normalizedNode\030\002 \001(\0132\'.org.opendaylig" +
+ "ht.controller.mdsal.Node\"N\n\007NodeMap\022C\n\nm" +
+ "apEntries\030\001 \003(\0132/.org.opendaylight.contr" +
+ "oller.mdsal.NodeMapEntryBO\n5org.opendayl",
+ "ight.controller.protobuff.messages.commo" +
+ "nB\026NormalizedNodeMessages"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
internal_static_org_opendaylight_controller_mdsal_PathArgumentAttribute_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_org_opendaylight_controller_mdsal_PathArgumentAttribute_descriptor,
- new java.lang.String[] { "Name", "Value", "Type", });
+ new java.lang.String[] { "Name", "Value", "Type", "InstanceIdentifierValue", "BitsValue", "BytesValue", });
internal_static_org_opendaylight_controller_mdsal_QName_descriptor =
getDescriptor().getMessageTypes().get(2);
internal_static_org_opendaylight_controller_mdsal_QName_fieldAccessorTable = new
optional QName name =1;
optional string value=2;
optional int32 type=3;
+ // Specific values
+ optional InstanceIdentifier instanceIdentifierValue = 4; // intValueType = YangInstanceIdentifier
+ repeated string bitsValue = 5; // intValueType = Bits
+ optional bytes bytesValue = 6;
+
}
package org.opendaylight.controller.cluster.datastore.node.utils.serialization;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
+import com.google.protobuf.ByteString;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Arrays;
+import java.util.Set;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.Set;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
public class ValueSerializerTest{
ImmutableSet.of("foo", "bar"));
assertEquals(ValueType.BITS_TYPE.ordinal(), builder1.getType());
- assertEquals("[foo, bar]", builder1.getValue());
+ assertTrue( "foo not in bits", builder1.getBitsValueList().contains("foo"));
+ assertTrue( "bar not in bits", builder1.getBitsValueList().contains("bar"));
}
assertEquals(1, serializedYangInstanceIdentifier.getArgumentsCount());
Mockito.verify(mockContext).addLocalName(TestModel.TEST_QNAME.getLocalName());
Mockito.verify(mockContext).addNamespace(TestModel.TEST_QNAME.getNamespace());
+
+ NormalizedNodeMessages.PathArgumentAttribute.Builder argumentBuilder
+ = NormalizedNodeMessages.PathArgumentAttribute.newBuilder();
+
+ mockContext = mock(QNameSerializationContext.class);
+
+ ValueSerializer.serialize(argumentBuilder, mockContext, v1);
+
+ serializedYangInstanceIdentifier =
+ argumentBuilder.getInstanceIdentifierValue();
+
+ assertEquals(1, serializedYangInstanceIdentifier.getArgumentsCount());
+ Mockito.verify(mockContext).addLocalName(TestModel.TEST_QNAME.getLocalName());
+ Mockito.verify(mockContext).addNamespace(TestModel.TEST_QNAME.getNamespace());
+
}
@Test
}
+ @Test
+ public void testSerializeBinary(){
+ NormalizedNodeMessages.Node.Builder builder = NormalizedNodeMessages.Node.newBuilder();
+ byte[] bytes = new byte[] {1,2,3,4};
+ ValueSerializer.serialize(builder, mock(QNameSerializationContext.class),bytes);
+
+ assertEquals(ValueType.BINARY_TYPE.ordinal(), builder.getIntValueType());
+ assertEquals(ByteString.copyFrom(bytes), builder.getBytesValue());
+
+ NormalizedNodeMessages.PathArgumentAttribute.Builder builder1 = NormalizedNodeMessages.PathArgumentAttribute.newBuilder();
+
+ ValueSerializer.serialize(builder1, mock(QNameSerializationContext.class),bytes);
+
+ assertEquals(ValueType.BINARY_TYPE.ordinal(), builder1.getType());
+ assertEquals(ByteString.copyFrom(bytes), builder1.getBytesValue());
+
+ }
+
+
@Test
public void testDeSerializeShort(){
NormalizedNodeMessages.Node.Builder nodeBuilder = NormalizedNodeMessages.Node.newBuilder();
assertTrue(((Set<?>)o).contains("foo"));
assertTrue(((Set<?>) o).contains("bar"));
+ NormalizedNodeMessages.PathArgumentAttribute.Builder argumentBuilder
+ = NormalizedNodeMessages.PathArgumentAttribute.newBuilder();
+
+ argumentBuilder.setType(ValueType.BITS_TYPE.ordinal());
+ argumentBuilder.addAllBitsValue(ImmutableList.of("foo", "bar"));
+
+ o = ValueSerializer
+ .deSerialize(mock(QNameDeSerializationContext.class),
+ argumentBuilder.build());
+
+ assertTrue(o instanceof Set);
+ assertTrue(((Set<?>)o).contains("foo"));
+ assertTrue(((Set<?>) o).contains("bar"));
+
}
@Test
assertTrue(o instanceof YangInstanceIdentifier);
assertEquals(TestModel.TEST_PATH, o);
+ NormalizedNodeMessages.PathArgumentAttribute.Builder argumentBuilder =
+ NormalizedNodeMessages.PathArgumentAttribute.newBuilder();
+
+ argumentBuilder.setType(ValueType.YANG_IDENTIFIER_TYPE.ordinal());
+ argumentBuilder.setInstanceIdentifierValue(idBuilder);
+
+ o = ValueSerializer.deSerialize(mockContext, argumentBuilder.build());
+
+ assertTrue(o instanceof YangInstanceIdentifier);
+ assertEquals(TestModel.TEST_PATH, o);
}
@Test
}
+
+ @Test
+ public void testDeSerializeBinaryType(){
+ NormalizedNodeMessages.Node.Builder nodeBuilder = NormalizedNodeMessages.Node.newBuilder();
+ nodeBuilder.setIntValueType(ValueType.BINARY_TYPE.ordinal());
+ byte[] bytes = new byte[] {1,2,3,4};
+ nodeBuilder.setBytesValue(ByteString.copyFrom(bytes));
+
+ Object o = ValueSerializer.deSerialize(mock(QNameDeSerializationContext.class),nodeBuilder.build());
+
+ assertTrue("not a byte array", o instanceof byte[]);
+ assertTrue("bytes value does not match" , Arrays.equals(bytes, (byte[]) o));
+
+ NormalizedNodeMessages.PathArgumentAttribute.Builder argumentBuilder =
+ NormalizedNodeMessages.PathArgumentAttribute.newBuilder();
+ argumentBuilder.setType(ValueType.BINARY_TYPE.ordinal());
+ argumentBuilder.setBytesValue(ByteString.copyFrom(bytes));
+
+ o = ValueSerializer.deSerialize(mock(QNameDeSerializationContext.class), argumentBuilder.build());
+
+ assertTrue("not a byte array", o instanceof byte[]);
+ assertTrue("bytes value does not match" ,Arrays.equals(bytes, (byte[]) o));
+
+
+ }
+
+
}
package org.opendaylight.controller.cluster.datastore;
import akka.actor.ActorRef;
+import akka.actor.Address;
public interface ClusterWrapper {
void subscribeToMemberEvents(ActorRef actorRef);
String getCurrentMemberName();
- String getSelfAddress();
+ Address getSelfAddress();
}
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
+import akka.actor.Address;
import akka.cluster.Cluster;
import akka.cluster.ClusterEvent;
import com.google.common.base.Preconditions;
public class ClusterWrapperImpl implements ClusterWrapper {
private final Cluster cluster;
private final String currentMemberName;
- private final String selfAddress;
+ private final Address selfAddress;
public ClusterWrapperImpl(ActorSystem actorSystem){
Preconditions.checkNotNull(actorSystem, "actorSystem should not be null");
);
currentMemberName = (String) cluster.getSelfRoles().toArray()[0];
- selfAddress = cluster.selfAddress().toString();
+ selfAddress = cluster.selfAddress();
}
return currentMemberName;
}
- public String getSelfAddress() {
+ public Address getSelfAddress() {
return selfAddress;
}
}
// TxActor is always created where the leader of the shard is.
// Check if TxActor is created in the same node
- boolean isTxActorLocal = actorContext.isLocalPath(transactionPath);
+ boolean isTxActorLocal = actorContext.isPathLocal(transactionPath);
return new TransactionContextImpl(transactionPath, transactionActor, identifier,
actorContext, schemaContext, isTxActorLocal, reply.getVersion());
import akka.actor.ActorRef;
import akka.actor.ActorSelection;
import akka.actor.ActorSystem;
+import akka.actor.Address;
import akka.actor.PoisonPill;
import akka.dispatch.Mapper;
import akka.pattern.AskTimeoutException;
import akka.util.Timeout;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
+import com.google.common.base.Strings;
+import java.util.concurrent.TimeUnit;
import org.opendaylight.controller.cluster.datastore.ClusterWrapper;
import org.opendaylight.controller.cluster.datastore.Configuration;
import org.opendaylight.controller.cluster.datastore.DatastoreContext;
import scala.concurrent.Future;
import scala.concurrent.duration.Duration;
import scala.concurrent.duration.FiniteDuration;
-import java.util.concurrent.TimeUnit;
+
import static akka.pattern.Patterns.ask;
/**
private volatile SchemaContext schemaContext;
private final FiniteDuration operationDuration;
private final Timeout operationTimeout;
+ private final String selfAddressHostPort;
public ActorContext(ActorSystem actorSystem, ActorRef shardManager,
ClusterWrapper clusterWrapper, Configuration configuration) {
operationDuration = Duration.create(datastoreContext.getOperationTimeoutInSeconds(),
TimeUnit.SECONDS);
operationTimeout = new Timeout(operationDuration);
+
+ Address selfAddress = clusterWrapper.getSelfAddress();
+ if (selfAddress != null && !selfAddress.host().isEmpty()) {
+ selfAddressHostPort = selfAddress.host().get() + ":" + selfAddress.port().get();
+ } else {
+ selfAddressHostPort = null;
+ }
}
public DatastoreContext getDatastoreContext() {
return operationDuration;
}
- public boolean isLocalPath(String path) {
- String selfAddress = clusterWrapper.getSelfAddress();
- if (path == null || selfAddress == null) {
+ public boolean isPathLocal(String path) {
+ if (Strings.isNullOrEmpty(path)) {
return false;
}
- int atIndex1 = path.indexOf("@");
- int atIndex2 = selfAddress.indexOf("@");
+ int pathAtIndex = path.indexOf("@");
+ if (pathAtIndex == -1) {
+ //if the path is of local format, then its local and is co-located
+ return true;
- if (atIndex1 == -1 || atIndex2 == -1) {
- return false;
- }
+ } else if (selfAddressHostPort != null) {
+ // self-address and tx actor path, both are of remote path format
+ int slashIndex = path.indexOf("/", pathAtIndex);
+
+ if (slashIndex == -1) {
+ return false;
+ }
- int slashIndex1 = path.indexOf("/", atIndex1);
- int slashIndex2 = selfAddress.indexOf("/", atIndex2);
+ String hostPort = path.substring(pathAtIndex + 1, slashIndex);
+ return hostPort.equals(selfAddressHostPort);
- if (slashIndex1 == -1 || slashIndex2 == -1) {
+ } else {
+ // self address is local format and tx actor path is remote format
return false;
}
-
- String hostPort1 = path.substring(atIndex1, slashIndex1);
- String hostPort2 = selfAddress.substring(atIndex2, slashIndex2);
-
- return hostPort1.equals(hostPort2);
}
/**
executeOperationAsync(eq(actorSystem.actorSelection(actorRef.path())),
eqCreateTransaction(memberName, type));
- doReturn(false).when(mockActorContext).isLocalPath(actorRef.path().toString());
+ doReturn(false).when(mockActorContext).isPathLocal(actorRef.path().toString());
return actorRef;
}
doReturn(readySerializedTxReply(actorRef.path().toString())).when(mockActorContext).executeOperationAsync(
eq(actorSelection(actorRef)), isA(ReadyTransaction.SERIALIZABLE_CLASS));
- doReturn(false).when(mockActorContext).isLocalPath(actorRef.path().toString());
+ doReturn(false).when(mockActorContext).isPathLocal(actorRef.path().toString());
TransactionProxy transactionProxy = new TransactionProxy(mockActorContext,
WRITE_ONLY);
executeOperationAsync(eq(actorSystem.actorSelection(shardActorRef.path())),
eqCreateTransaction(memberName, READ_ONLY));
- doReturn(true).when(mockActorContext).isLocalPath(actorPath);
+ doReturn(true).when(mockActorContext).isPathLocal(actorPath);
TransactionProxy transactionProxy = new TransactionProxy(mockActorContext,READ_ONLY);
executeOperationAsync(eq(actorSystem.actorSelection(shardActorRef.path())),
eqCreateTransaction(memberName, WRITE_ONLY));
- doReturn(true).when(mockActorContext).isLocalPath(actorPath);
+ doReturn(true).when(mockActorContext).isPathLocal(actorPath);
NormalizedNode<?, ?> nodeToWrite = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
import akka.actor.ActorRef;
import akka.actor.ActorSelection;
import akka.actor.ActorSystem;
+import akka.actor.Address;
import akka.actor.Props;
import akka.actor.UntypedActor;
import akka.japi.Creator;
import akka.testkit.JavaTestKit;
import com.google.common.base.Optional;
+import java.util.concurrent.TimeUnit;
import org.junit.Test;
import org.opendaylight.controller.cluster.datastore.AbstractActorTest;
import org.opendaylight.controller.cluster.datastore.ClusterWrapper;
import scala.concurrent.Future;
import scala.concurrent.duration.Duration;
-import java.util.concurrent.TimeUnit;
-
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
}
@Test
- public void testIsLocalPath() {
+ public void testIsPathLocal() {
MockClusterWrapper clusterWrapper = new MockClusterWrapper();
- ActorContext actorContext =
- new ActorContext(getSystem(), null, clusterWrapper, mock(Configuration.class));
+ ActorContext actorContext = null;
- clusterWrapper.setSelfAddress("");
- assertEquals(false, actorContext.isLocalPath(null));
- assertEquals(false, actorContext.isLocalPath(""));
+ actorContext = new ActorContext(getSystem(), null, clusterWrapper, mock(Configuration.class));
+ assertEquals(false, actorContext.isPathLocal(null));
+ assertEquals(false, actorContext.isPathLocal(""));
clusterWrapper.setSelfAddress(null);
- assertEquals(false, actorContext.isLocalPath(""));
-
- clusterWrapper.setSelfAddress("akka://test/user/$b");
- assertEquals(false, actorContext.isLocalPath("akka://test/user/$a"));
-
- clusterWrapper.setSelfAddress("akka.tcp://system@127.0.0.1:2550/");
- assertEquals(true, actorContext.isLocalPath("akka.tcp://system@127.0.0.1:2550/"));
-
- clusterWrapper.setSelfAddress("akka.tcp://system@127.0.0.1:2550");
- assertEquals(false, actorContext.isLocalPath("akka.tcp://system@127.0.0.1:2550/"));
-
- clusterWrapper.setSelfAddress("akka.tcp://system@128.0.0.1:2550/");
- assertEquals(false, actorContext.isLocalPath("akka.tcp://system@127.0.0.1:2550/"));
-
- clusterWrapper.setSelfAddress("akka.tcp://system@127.0.0.1:2551/");
- assertEquals(false, actorContext.isLocalPath("akka.tcp://system@127.0.0.1:2550/"));
+ actorContext = new ActorContext(getSystem(), null, clusterWrapper, mock(Configuration.class));
+ assertEquals(false, actorContext.isPathLocal(""));
+
+ // even if the path is in local format, match the primary path (first 3 elements) and return true
+ clusterWrapper.setSelfAddress(new Address("akka", "test"));
+ actorContext = new ActorContext(getSystem(), null, clusterWrapper, mock(Configuration.class));
+ assertEquals(true, actorContext.isPathLocal("akka://test/user/$a"));
+
+ clusterWrapper.setSelfAddress(new Address("akka", "test"));
+ actorContext = new ActorContext(getSystem(), null, clusterWrapper, mock(Configuration.class));
+ assertEquals(true, actorContext.isPathLocal("akka://test/user/$a"));
+
+ clusterWrapper.setSelfAddress(new Address("akka", "test"));
+ actorContext = new ActorContext(getSystem(), null, clusterWrapper, mock(Configuration.class));
+ assertEquals(true, actorContext.isPathLocal("akka://test/user/token2/token3/$a"));
+
+ // self address of remote format,but Tx path local format.
+ clusterWrapper.setSelfAddress(new Address("akka.tcp", "system", "127.0.0.1", 2550));
+ actorContext = new ActorContext(getSystem(), null, clusterWrapper, mock(Configuration.class));
+ assertEquals(true, actorContext.isPathLocal(
+ "akka://system/user/shardmanager/shard/transaction"));
+
+ // self address of local format,but Tx path remote format.
+ clusterWrapper.setSelfAddress(new Address("akka.tcp", "system"));
+ actorContext = new ActorContext(getSystem(), null, clusterWrapper, mock(Configuration.class));
+ assertEquals(false, actorContext.isPathLocal(
+ "akka://system@127.0.0.1:2550/user/shardmanager/shard/transaction"));
+
+ //local path but not same
+ clusterWrapper.setSelfAddress(new Address("akka", "test"));
+ actorContext = new ActorContext(getSystem(), null, clusterWrapper, mock(Configuration.class));
+ assertEquals(true, actorContext.isPathLocal("akka://test1/user/$a"));
+
+ //ip and port same
+ clusterWrapper.setSelfAddress(new Address("akka.tcp", "system", "127.0.0.1", 2550));
+ actorContext = new ActorContext(getSystem(), null, clusterWrapper, mock(Configuration.class));
+ assertEquals(true, actorContext.isPathLocal("akka.tcp://system@127.0.0.1:2550/"));
+
+ // forward-slash missing in address
+ clusterWrapper.setSelfAddress(new Address("akka.tcp", "system", "127.0.0.1", 2550));
+ actorContext = new ActorContext(getSystem(), null, clusterWrapper, mock(Configuration.class));
+ assertEquals(false, actorContext.isPathLocal("akka.tcp://system@127.0.0.1:2550"));
+
+ //ips differ
+ clusterWrapper.setSelfAddress(new Address("akka.tcp", "system", "127.0.0.1", 2550));
+ actorContext = new ActorContext(getSystem(), null, clusterWrapper, mock(Configuration.class));
+ assertEquals(false, actorContext.isPathLocal("akka.tcp://system@127.1.0.1:2550/"));
+
+ //ports differ
+ clusterWrapper.setSelfAddress(new Address("akka.tcp", "system", "127.0.0.1", 2550));
+ actorContext = new ActorContext(getSystem(), null, clusterWrapper, mock(Configuration.class));
+ assertEquals(false, actorContext.isPathLocal("akka.tcp://system@127.0.0.1:2551/"));
}
@Test
package org.opendaylight.controller.cluster.datastore.utils;
import akka.actor.ActorRef;
+import akka.actor.Address;
import akka.actor.AddressFromURIString;
import akka.cluster.ClusterEvent;
import akka.cluster.MemberStatus;
public class MockClusterWrapper implements ClusterWrapper{
- private String selfAddress = "akka.tcp://test@127.0.0.1:2550/user/member-1-shard-test-config";
+ private Address selfAddress = new Address("akka.tcp", "test", "127.0.0.1", 2550);
@Override
public void subscribeToMemberEvents(ActorRef actorRef) {
}
@Override
- public String getSelfAddress() {
+ public Address getSelfAddress() {
return selfAddress;
}
- public void setSelfAddress(String selfAddress) {
+ public void setSelfAddress(Address selfAddress) {
this.selfAddress = selfAddress;
}
*/
package org.opendaylight.controller.md.sal.dom.broker.impl;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Iterables;
+import com.google.common.util.concurrent.AbstractFuture;
+import com.google.common.util.concurrent.AbstractListeningExecutorService;
+import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
import java.util.List;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import org.opendaylight.yangtools.util.concurrent.MappingCheckedFuture;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Iterables;
-import com.google.common.util.concurrent.AbstractFuture;
-import com.google.common.util.concurrent.AbstractListeningExecutorService;
-import com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
/**
* Implementation of DOMDataCommitExecutor that coordinates transaction commits concurrently. The 3
public void onSuccess(Boolean result) {
if (result == null || !result) {
handleException(clientSubmitFuture, transaction, cohorts, cohortSize,
- CAN_COMMIT, new TransactionCommitFailedException(
+ CAN_COMMIT, TransactionCommitFailedExceptionMapper.CAN_COMMIT_ERROR_MAPPER,
+ new TransactionCommitFailedException(
"Can Commit failed, no detailed cause available."));
} else {
if(remaining.decrementAndGet() == 0) {
@Override
public void onFailure(Throwable t) {
- handleException(clientSubmitFuture, transaction, cohorts, cohortSize, CAN_COMMIT, t);
+ handleException(clientSubmitFuture, transaction, cohorts, cohortSize, CAN_COMMIT,
+ TransactionCommitFailedExceptionMapper.CAN_COMMIT_ERROR_MAPPER, t);
}
};
@Override
public void onFailure(Throwable t) {
- handleException(clientSubmitFuture, transaction, cohorts, cohortSize, CAN_COMMIT, t);
+ handleException(clientSubmitFuture, transaction, cohorts, cohortSize, PRE_COMMIT,
+ TransactionCommitFailedExceptionMapper.PRE_COMMIT_MAPPER, t);
}
};
@Override
public void onFailure(Throwable t) {
- handleException(clientSubmitFuture, transaction, cohorts, cohortSize, CAN_COMMIT, t);
+ handleException(clientSubmitFuture, transaction, cohorts, cohortSize, COMMIT,
+ TransactionCommitFailedExceptionMapper.COMMIT_ERROR_MAPPER, t);
}
};
private void handleException(final AsyncNotifyingSettableFuture clientSubmitFuture,
final DOMDataWriteTransaction transaction,
final Iterable<DOMStoreThreePhaseCommitCohort> cohorts, int cohortSize,
- final String phase, final Throwable t) {
+ final String phase, final TransactionCommitFailedExceptionMapper exMapper,
+ final Throwable t) {
if(clientSubmitFuture.isDone()) {
// We must have had failures from multiple cohorts.
e = new RuntimeException("Unexpected error occurred", t);
}
- final TransactionCommitFailedException clientException =
- TransactionCommitFailedExceptionMapper.CAN_COMMIT_ERROR_MAPPER.apply(e);
+ final TransactionCommitFailedException clientException = exMapper.apply(e);
// Transaction failed - tell all cohorts to abort.
final class TransactionCommitFailedExceptionMapper
extends ExceptionMapper<TransactionCommitFailedException> {
- static final TransactionCommitFailedExceptionMapper PRE_COMMIT_MAPPER = create("canCommit");
+ static final TransactionCommitFailedExceptionMapper PRE_COMMIT_MAPPER = create("preCommit");
- static final TransactionCommitFailedExceptionMapper CAN_COMMIT_ERROR_MAPPER = create("preCommit");
+ static final TransactionCommitFailedExceptionMapper CAN_COMMIT_ERROR_MAPPER = create("canCommit");
static final TransactionCommitFailedExceptionMapper COMMIT_ERROR_MAPPER = create("commit");
logger.error("{}: Initialization in sal failed, disconnecting from device", id, t);
listener.close();
onRemoteSessionDown();
+ resetMessageTransformer();
+ }
+
+ /**
+ * Set the schema context inside transformer to null as is in initial state
+ */
+ private void resetMessageTransformer() {
+ updateMessageTransformer(null);
}
/**
for (final SchemaSourceRegistration<? extends SchemaSourceRepresentation> sourceRegistration : sourceRegistrations) {
sourceRegistration.close();
}
+ resetMessageTransformer();
}
@Override
package org.opendaylight.controller.sal.connect.netconf.schema.mapping;
import com.google.common.base.Optional;
-
import java.util.List;
import java.util.Set;
-
import javax.activation.UnsupportedDataTypeException;
-
import org.opendaylight.controller.netconf.api.NetconfMessage;
import org.opendaylight.controller.sal.connect.api.MessageTransformer;
import org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil;
@Override
public synchronized void onGlobalContextUpdated(final SchemaContext schemaContext) {
- this.schemaContext = Optional.of(schemaContext);
+ this.schemaContext = Optional.fromNullable(schemaContext);
}
}
device.onRemoteSessionUp(sessionCaps, listener);
verify(schemaContextProviderFactory, timeout(5000).times(2)).createSchemaContext(any(Collection.class));
- verify(messageTransformer, timeout(5000).times(2)).onGlobalContextUpdated(any(SchemaContext.class));
+ verify(messageTransformer, timeout(5000).times(3)).onGlobalContextUpdated(any(SchemaContext.class));
verify(facade, timeout(5000).times(2)).onDeviceConnected(any(SchemaContext.class), any(NetconfSessionCapabilities.class), any(RpcImplementation.class));
}