enabling checkstyle checks on build which should prevent
checkstyle violations in future.
Change-Id: I6aba04ad46b317179a158fa7ce13b67882cfd942
Signed-off-by: Michal Cmarada <mcmarada@cisco.com>
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class EndpointsListener implements ClusteredDataTreeChangeListener<AddressEndpoint>{
+public class EndpointsListener implements ClusteredDataTreeChangeListener<AddressEndpoint> {
private static final Logger LOG = LoggerFactory.getLogger(EndpointsListener.class);
private NeLocationProvider listener;
private ListenerRegistration<EndpointsListener> listenerRegistration;
private static final Logger LOG = LoggerFactory.getLogger(EndpointsListener.class);
private NeLocationProvider listener;
private ListenerRegistration<EndpointsListener> listenerRegistration;
- public EndpointsListener (DataBroker dataBroker, NeLocationProvider listener) {
+ public EndpointsListener(DataBroker dataBroker, NeLocationProvider listener) {
this.listener = listener;
this.listener = listener;
- this.listenerRegistration = dataBroker.registerDataTreeChangeListener(new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL,
- InstanceIdentifier.builder(Endpoints.class)
+ this.listenerRegistration = dataBroker.registerDataTreeChangeListener(new DataTreeIdentifier<>(
+ LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.builder(Endpoints.class)
.child(AddressEndpoints.class).child(AddressEndpoint.class).build()), this);
LOG.info("NE location provider registered for Endpoints listening");
}
.child(AddressEndpoints.class).child(AddressEndpoint.class).build()), this);
LOG.info("NE location provider registered for Endpoints listening");
}
package org.opendaylight.groupbasedpolicy.ne.location.provider;
package org.opendaylight.groupbasedpolicy.ne.location.provider;
+import com.google.common.annotations.VisibleForTesting;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.annotations.VisibleForTesting;
-
public class NeLocationProvider implements ClusteredDataTreeChangeListener<NetworkElements>, AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(NeLocationProvider.class);
public class NeLocationProvider implements ClusteredDataTreeChangeListener<NetworkElements>, AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(NeLocationProvider.class);
this.endpoints.add(change.getRootNode().getDataAfter());
break;
}
this.endpoints.add(change.getRootNode().getDataAfter());
break;
}
+ default:
+ //noop
+ break;
}
}
DataStoreHelper.submitToDs(wtx);
}
}
DataStoreHelper.submitToDs(wtx);
.providerAddressEndpointLocationIid(NE_LOCATION_PROVIDER_NAME, IpPrefixType.class,
endpoint.getAddress(), endpoint.getContextType(), endpoint.getContextId())
.child(AbsoluteLocation.class);
.providerAddressEndpointLocationIid(NE_LOCATION_PROVIDER_NAME, IpPrefixType.class,
endpoint.getAddress(), endpoint.getContextType(), endpoint.getContextId())
.child(AbsoluteLocation.class);
- wtx.put(LogicalDatastoreType.CONFIGURATION, iid, createRealLocation(ne.getIid(), iface.getIid()),
+ wtx.put(LogicalDatastoreType.CONFIGURATION, iid,
+ createRealLocation(ne.getIid(), iface.getIid()),
true);
LOG.debug("New location created for endpoint {}", endpoint);
return;
true);
LOG.debug("New location created for endpoint {}", endpoint);
return;
+ default:
+ //noop
+ break;
}
}
DataStoreHelper.submitToDs(wtx);
}
}
DataStoreHelper.submitToDs(wtx);
private List<DataObjectModification<NetworkElement>> getModifiedNetworkElements(
DataObjectModification<NetworkElements> modifiedNEs) {
private List<DataObjectModification<NetworkElement>> getModifiedNetworkElements(
DataObjectModification<NetworkElements> modifiedNEs) {
- Collection<DataObjectModification<? extends DataObject>> potentialModifiedNetworkElements =
+ Collection<DataObjectModification<? extends DataObject>> modifiedNetworkElements =
modifiedNEs.getModifiedChildren();
modifiedNEs.getModifiedChildren();
- if (potentialModifiedNetworkElements == null) {
- return Collections.emptyList();
- }
List<DataObjectModification<NetworkElement>> nes = new ArrayList<>();
List<DataObjectModification<NetworkElement>> nes = new ArrayList<>();
- for (DataObjectModification<? extends DataObject> potentialModifiedNetworkElement : potentialModifiedNetworkElements) {
- if (potentialModifiedNetworkElement.getDataType().isAssignableFrom(NetworkElement.class)) {
- nes.add((DataObjectModification<NetworkElement>) potentialModifiedNetworkElement);
+ for (DataObjectModification<? extends DataObject> modifiedNetworkElement : modifiedNetworkElements) {
+ if (modifiedNetworkElement.getDataType().isAssignableFrom(NetworkElement.class)) {
+ nes.add((DataObjectModification<NetworkElement>) modifiedNetworkElement);
+ default:
+ //noop
+ break;
+ default:
+ //noop
+ break;
LOG.debug("EndpointNetwork {} changed", modifiedEN.getDataAfter().getKey());
break;
}
LOG.debug("EndpointNetwork {} changed", modifiedEN.getDataAfter().getKey());
break;
}
+ default:
+ //noop
+ break;
private ListenerRegistration<EndpointsListener> listenerRegistration;
@Before
private ListenerRegistration<EndpointsListener> listenerRegistration;
@Before
dataBroker = mock(DataBroker.class);
listenerRegistration = mock(ListenerRegistration.class);
when(dataBroker.registerDataTreeChangeListener(any(), Matchers.any(EndpointsListener.class)))
dataBroker = mock(DataBroker.class);
listenerRegistration = mock(ListenerRegistration.class);
when(dataBroker.registerDataTreeChangeListener(any(), Matchers.any(EndpointsListener.class)))
- .thenReturn(listenerRegistration);
+ .thenReturn(listenerRegistration);
listener = mock(NeLocationProvider.class);
endpointsListener = new EndpointsListener(dataBroker, listener);
}
@Test
listener = mock(NeLocationProvider.class);
endpointsListener = new EndpointsListener(dataBroker, listener);
}
@Test
- public void test_RegistrationDone () {
+ public void test_RegistrationDone() {
verify(dataBroker).registerDataTreeChangeListener(new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL,
InstanceIdentifier.builder(Endpoints.class).child(AddressEndpoints.class)
.child(AddressEndpoint.class).build()), endpointsListener);
}
@Test
verify(dataBroker).registerDataTreeChangeListener(new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL,
InstanceIdentifier.builder(Endpoints.class).child(AddressEndpoints.class)
.child(AddressEndpoint.class).build()), endpointsListener);
}
@Test
- public void test_ListenerNotification () {
+ public void test_ListenerNotification() {
endpointsListener.onDataTreeChanged(null);
verify(listener).onEndpointsChange(any());
}
@Test
endpointsListener.onDataTreeChanged(null);
verify(listener).onEndpointsChange(any());
}
@Test
- public void test_UnregiserOnClose () {
+ public void test_UnregiserOnClose() {
endpointsListener.close();
verify(listenerRegistration).close();
}
endpointsListener.close();
verify(listenerRegistration).close();
}
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableList;
+import com.google.common.util.concurrent.CheckedFuture;
+
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableList;
-import com.google.common.util.concurrent.CheckedFuture;
-
public class NeLocationProviderTest extends CustomDataBrokerTest {
private static final TenantId TENANT = new TenantId("Tenant");
private static final List<EndpointGroupId> DEFAULT_EPG =
Collections.singletonList(new EndpointGroupId("defaultEPG"));
public class NeLocationProviderTest extends CustomDataBrokerTest {
private static final TenantId TENANT = new TenantId("Tenant");
private static final List<EndpointGroupId> DEFAULT_EPG =
Collections.singletonList(new EndpointGroupId("defaultEPG"));
+ private static final String L3_CONTEXT_ID = "l3Context";
+ private static final String IP_V4_HOST_ADDRESS_1 = "192.168.50.71/24";
+ private static final String IP_V4_NETWORK_ADDRESS_1 = "192.168.50.0/24";
+ private static final String IP_V4_NETWORK_ADDRESS_2 = "192.168.51.0/24";
+ private static final String NODE_ID_1 = "node1";
+ private static final String NODE_ID_2 = "node2";
+ private static final String CONNECTOR_ID_1 = "connector:1";
+ private static final String CONNECTOR_ID_2 = "connector:2";
private DataBroker dataBroker;
private NeLocationProvider neProvider;
private DataBroker dataBroker;
private NeLocationProvider neProvider;
- private String L3_CONTEXT_ID = "l3Context";
- private String IPv4_HOST_ADDRESS_1 = "192.168.50.71/24";
- private String IPv4_HOST_ADDRESS_2 = "192.168.50.72/24";
- private String IPv4_NETWORK_ADDRESS_1 = "192.168.50.0/24";
- private String IPv4_NETWORK_ADDRESS_2 = "192.168.51.0/24";
- private String NODE_ID_1 = "node1";
- private String NODE_ID_2 = "node2";
- private String CONNECTOR_ID_1 = "connector:1";
- private String CONNECTOR_ID_2 = "connector:2";
@Override
public Collection<Class<?>> getClassesFromModules() {
@Override
public Collection<Class<?>> getClassesFromModules() {
ListenerRegistration<EndpointsListener> endpointsListenerRegistration = mock(ListenerRegistration.class);
when(dataBroker.registerDataTreeChangeListener(any(), isA(EndpointsListener.class)))
.thenReturn(endpointsListenerRegistration);
ListenerRegistration<EndpointsListener> endpointsListenerRegistration = mock(ListenerRegistration.class);
when(dataBroker.registerDataTreeChangeListener(any(), isA(EndpointsListener.class)))
.thenReturn(endpointsListenerRegistration);
- ListenerRegistration<NeLocationProvider> NEListenerRegistration = mock(ListenerRegistration.class);
+ ListenerRegistration<NeLocationProvider> nelistenerregistration = mock(ListenerRegistration.class);
when(dataBroker.registerDataTreeChangeListener(any(), isA(NeLocationProvider.class)))
when(dataBroker.registerDataTreeChangeListener(any(), isA(NeLocationProvider.class)))
- .thenReturn(NEListenerRegistration);
+ .thenReturn(nelistenerregistration);
NeLocationProvider provider = new NeLocationProvider(dataBroker);
provider.close();
verify(endpointsListenerRegistration).close();
NeLocationProvider provider = new NeLocationProvider(dataBroker);
provider.close();
verify(endpointsListenerRegistration).close();
- verify(NEListenerRegistration).close();
+ verify(nelistenerregistration).close();
new NetworkDomainContainmentBuilder().setNetworkDomainId(new NetworkDomainId(L3_CONTEXT_ID)).build())
.build();
AddressEndpoint endpoint = new AddressEndpointBuilder().setKey(
new NetworkDomainContainmentBuilder().setNetworkDomainId(new NetworkDomainId(L3_CONTEXT_ID)).build())
.build();
AddressEndpoint endpoint = new AddressEndpointBuilder().setKey(
- new AddressEndpointKey(IPv4_HOST_ADDRESS_1, IpPrefixType.class, new ContextId(L3_CONTEXT_ID),
+ new AddressEndpointKey(IP_V4_HOST_ADDRESS_1, IpPrefixType.class, new ContextId(L3_CONTEXT_ID),
L3Context.class)).setNetworkContainment(nc).setTenant(TENANT).setEndpointGroup(DEFAULT_EPG).build();
InstanceIdentifier<AddressEndpoint> iid = IidFactory.addressEndpointIid(endpoint.getKey());
WriteTransaction wtx = dataBroker.newWriteOnlyTransaction();
L3Context.class)).setNetworkContainment(nc).setTenant(TENANT).setEndpointGroup(DEFAULT_EPG).build();
InstanceIdentifier<AddressEndpoint> iid = IidFactory.addressEndpointIid(endpoint.getKey());
WriteTransaction wtx = dataBroker.newWriteOnlyTransaction();
InstanceIdentifier<NetworkContainment> iid = InstanceIdentifier
.builder(Endpoints.class)
.child(AddressEndpoints.class)
InstanceIdentifier<NetworkContainment> iid = InstanceIdentifier
.builder(Endpoints.class)
.child(AddressEndpoints.class)
- .child(AddressEndpoint.class, new AddressEndpointKey(IPv4_HOST_ADDRESS_1, IpPrefixType.class,
+ .child(AddressEndpoint.class, new AddressEndpointKey(IP_V4_HOST_ADDRESS_1, IpPrefixType.class,
new ContextId(L3_CONTEXT_ID), L3Context.class))
.child(NetworkContainment.class)
.build();
new ContextId(L3_CONTEXT_ID), L3Context.class))
.child(NetworkContainment.class)
.build();
@Test
public void test_NetworkElementsWrite_NoEP_Overwrite() throws Exception {
writeBaseNetworkElements();
@Test
public void test_NetworkElementsWrite_NoEP_Overwrite() throws Exception {
writeBaseNetworkElements();
- NetworkElements nes = createNetworkElements(NODE_ID_2, CONNECTOR_ID_2, L3_CONTEXT_ID, IPv4_NETWORK_ADDRESS_1);
+ NetworkElements nes = createNetworkElements(NODE_ID_2, CONNECTOR_ID_2, L3_CONTEXT_ID, IP_V4_NETWORK_ADDRESS_1);
InstanceIdentifier<NetworkElements> iid = InstanceIdentifier.builder(NetworkElements.class).build();
WriteTransaction wtx = dataBroker.newWriteOnlyTransaction();
wtx.put(LogicalDatastoreType.CONFIGURATION, iid, nes);
InstanceIdentifier<NetworkElements> iid = InstanceIdentifier.builder(NetworkElements.class).build();
WriteTransaction wtx = dataBroker.newWriteOnlyTransaction();
wtx.put(LogicalDatastoreType.CONFIGURATION, iid, nes);
@Test
public void test_NetworkElementWrite_NoEP_Overwrite() throws Exception {
writeBaseNetworkElements();
@Test
public void test_NetworkElementWrite_NoEP_Overwrite() throws Exception {
writeBaseNetworkElements();
- NetworkElement ne = createNetworkElement(NODE_ID_1, CONNECTOR_ID_1, L3_CONTEXT_ID, IPv4_NETWORK_ADDRESS_2);
+ NetworkElement ne = createNetworkElement(NODE_ID_1, CONNECTOR_ID_1, L3_CONTEXT_ID, IP_V4_NETWORK_ADDRESS_2);
InstanceIdentifier<NetworkElement> iid = InstanceIdentifier.builder(NetworkElements.class)
.child(NetworkElement.class, new NetworkElementKey(ne.getKey()))
.build();
InstanceIdentifier<NetworkElement> iid = InstanceIdentifier.builder(NetworkElements.class)
.child(NetworkElement.class, new NetworkElementKey(ne.getKey()))
.build();
@Test
public void test_InterfaceWrite_NoEP_Overwrite() throws Exception {
writeBaseNetworkElements();
@Test
public void test_InterfaceWrite_NoEP_Overwrite() throws Exception {
writeBaseNetworkElements();
- Interface iface = createInterface(NODE_ID_1, CONNECTOR_ID_1, L3_CONTEXT_ID, IPv4_NETWORK_ADDRESS_2);
+ Interface iface = createInterface(NODE_ID_1, CONNECTOR_ID_1, L3_CONTEXT_ID, IP_V4_NETWORK_ADDRESS_2);
InstanceIdentifier<Interface> iid = InstanceIdentifier.builder(NetworkElements.class)
.child(NetworkElement.class, new NetworkElementKey(createNetworkElementIid(NODE_ID_1)))
.child(Interface.class, new InterfaceKey(iface.getKey()))
InstanceIdentifier<Interface> iid = InstanceIdentifier.builder(NetworkElements.class)
.child(NetworkElement.class, new NetworkElementKey(createNetworkElementIid(NODE_ID_1)))
.child(Interface.class, new InterfaceKey(iface.getKey()))
@Test
public void test_EndpointNetworkChange_NoEP() throws Exception {
writeBaseNetworkElements();
@Test
public void test_EndpointNetworkChange_NoEP() throws Exception {
writeBaseNetworkElements();
- EndpointNetwork en = createEndpointNetwork(L3_CONTEXT_ID, IPv4_NETWORK_ADDRESS_2);
+ EndpointNetwork en = createEndpointNetwork(L3_CONTEXT_ID, IP_V4_NETWORK_ADDRESS_2);
InstanceIdentifier<EndpointNetwork> iid = InstanceIdentifier.builder(NetworkElements.class)
.child(NetworkElement.class, new NetworkElementKey(createNetworkElementIid(NODE_ID_1)))
.child(Interface.class, new InterfaceKey(CONNECTOR_ID_1))
InstanceIdentifier<EndpointNetwork> iid = InstanceIdentifier.builder(NetworkElements.class)
.child(NetworkElement.class, new NetworkElementKey(createNetworkElementIid(NODE_ID_1)))
.child(Interface.class, new InterfaceKey(CONNECTOR_ID_1))
.child(NetworkElement.class, new NetworkElementKey(createNetworkElementIid(NODE_ID_1)))
.child(Interface.class, new InterfaceKey(CONNECTOR_ID_1))
.child(EndpointNetwork.class, new EndpointNetworkKey(
.child(NetworkElement.class, new NetworkElementKey(createNetworkElementIid(NODE_ID_1)))
.child(Interface.class, new InterfaceKey(CONNECTOR_ID_1))
.child(EndpointNetwork.class, new EndpointNetworkKey(
- new IpPrefix(new Ipv4Prefix(IPv4_NETWORK_ADDRESS_1)),new ContextId(L3_CONTEXT_ID)))
+ new IpPrefix(new Ipv4Prefix(IP_V4_NETWORK_ADDRESS_1)),new ContextId(L3_CONTEXT_ID)))
.build();
WriteTransaction wtx = dataBroker.newWriteOnlyTransaction();
wtx.delete(LogicalDatastoreType.CONFIGURATION, removeIid);
.build();
WriteTransaction wtx = dataBroker.newWriteOnlyTransaction();
wtx.delete(LogicalDatastoreType.CONFIGURATION, removeIid);
@Test
public void test_CreateLocationForAddrEndpoint_EndpointWriteFirst() throws Exception {
AddressEndpoint endpoint =
@Test
public void test_CreateLocationForAddrEndpoint_EndpointWriteFirst() throws Exception {
AddressEndpoint endpoint =
- createAddressEndpoint(IPv4_HOST_ADDRESS_1, IpPrefixType.class, L3_CONTEXT_ID, L3Context.class);
+ createAddressEndpoint(IP_V4_HOST_ADDRESS_1, IpPrefixType.class, L3_CONTEXT_ID, L3Context.class);
InstanceIdentifier<AddressEndpoint> iid = IidFactory.addressEndpointIid(endpoint.getKey());
WriteTransaction wtx = dataBroker.newWriteOnlyTransaction();
wtx.put(LogicalDatastoreType.OPERATIONAL, iid, endpoint, true);
wtx.submit().get();
InstanceIdentifier<AddressEndpoint> iid = IidFactory.addressEndpointIid(endpoint.getKey());
WriteTransaction wtx = dataBroker.newWriteOnlyTransaction();
wtx.put(LogicalDatastoreType.OPERATIONAL, iid, endpoint, true);
wtx.submit().get();
- NetworkElements nes = createNetworkElements(NODE_ID_1, CONNECTOR_ID_1, L3_CONTEXT_ID, IPv4_NETWORK_ADDRESS_1);
+ NetworkElements nes = createNetworkElements(NODE_ID_1, CONNECTOR_ID_1, L3_CONTEXT_ID, IP_V4_NETWORK_ADDRESS_1);
InstanceIdentifier<NetworkElements> neIid = InstanceIdentifier.builder(NetworkElements.class).build();
wtx = dataBroker.newWriteOnlyTransaction();
wtx.put(LogicalDatastoreType.CONFIGURATION, neIid, nes);
InstanceIdentifier<NetworkElements> neIid = InstanceIdentifier.builder(NetworkElements.class).build();
wtx = dataBroker.newWriteOnlyTransaction();
wtx.put(LogicalDatastoreType.CONFIGURATION, neIid, nes);
.setProvider(new ProviderName(NeLocationProvider.NE_LOCATION_PROVIDER_NAME))
.setProviderAddressEndpointLocation(Collections.singletonList(
new ProviderAddressEndpointLocationBuilder()
.setProvider(new ProviderName(NeLocationProvider.NE_LOCATION_PROVIDER_NAME))
.setProviderAddressEndpointLocation(Collections.singletonList(
new ProviderAddressEndpointLocationBuilder()
- .setAddress(IPv4_HOST_ADDRESS_1)
+ .setAddress(IP_V4_HOST_ADDRESS_1)
.setAddressType(IpPrefixType.class)
.setContextId(new ContextId(L3_CONTEXT_ID))
.setContextType(L3Context.class)
.setAddressType(IpPrefixType.class)
.setContextId(new ContextId(L3_CONTEXT_ID))
.setContextType(L3Context.class)
@Test
public void test_CreateLocationForAddrEndpoint_NEWriteFirst() throws Exception {
@Test
public void test_CreateLocationForAddrEndpoint_NEWriteFirst() throws Exception {
- NetworkElements nes = createNetworkElements(NODE_ID_1, CONNECTOR_ID_1, L3_CONTEXT_ID, IPv4_NETWORK_ADDRESS_1);
+ NetworkElements nes = createNetworkElements(NODE_ID_1, CONNECTOR_ID_1, L3_CONTEXT_ID, IP_V4_NETWORK_ADDRESS_1);
InstanceIdentifier<NetworkElements> neIid = InstanceIdentifier.builder(NetworkElements.class).build();
WriteTransaction wtx = dataBroker.newWriteOnlyTransaction();
wtx.put(LogicalDatastoreType.CONFIGURATION, neIid, nes);
AddressEndpoint endpoint =
InstanceIdentifier<NetworkElements> neIid = InstanceIdentifier.builder(NetworkElements.class).build();
WriteTransaction wtx = dataBroker.newWriteOnlyTransaction();
wtx.put(LogicalDatastoreType.CONFIGURATION, neIid, nes);
AddressEndpoint endpoint =
- createAddressEndpoint(IPv4_HOST_ADDRESS_1, IpPrefixType.class, L3_CONTEXT_ID, L3Context.class);
+ createAddressEndpoint(IP_V4_HOST_ADDRESS_1, IpPrefixType.class, L3_CONTEXT_ID, L3Context.class);
InstanceIdentifier<AddressEndpoint> iid = IidFactory.addressEndpointIid(endpoint.getKey());
wtx.put(LogicalDatastoreType.OPERATIONAL, iid, endpoint, true);
wtx.submit().get();
InstanceIdentifier<AddressEndpoint> iid = IidFactory.addressEndpointIid(endpoint.getKey());
wtx.put(LogicalDatastoreType.OPERATIONAL, iid, endpoint, true);
wtx.submit().get();
.setProvider(new ProviderName(NeLocationProvider.NE_LOCATION_PROVIDER_NAME))
.setProviderAddressEndpointLocation(Collections.singletonList(
new ProviderAddressEndpointLocationBuilder()
.setProvider(new ProviderName(NeLocationProvider.NE_LOCATION_PROVIDER_NAME))
.setProviderAddressEndpointLocation(Collections.singletonList(
new ProviderAddressEndpointLocationBuilder()
- .setAddress(IPv4_HOST_ADDRESS_1)
+ .setAddress(IP_V4_HOST_ADDRESS_1)
.setAddressType(IpPrefixType.class)
.setContextId(new ContextId(L3_CONTEXT_ID))
.setContextType(L3Context.class)
.setAddressType(IpPrefixType.class)
.setContextId(new ContextId(L3_CONTEXT_ID))
.setContextType(L3Context.class)
@Test
public void test_CreateLocationForAddrEndpoint_SimultaneousWrite() throws Exception {
@Test
public void test_CreateLocationForAddrEndpoint_SimultaneousWrite() throws Exception {
- NetworkElements nes = createNetworkElements(NODE_ID_1, CONNECTOR_ID_1, L3_CONTEXT_ID, IPv4_NETWORK_ADDRESS_1);
+ NetworkElements nes = createNetworkElements(NODE_ID_1, CONNECTOR_ID_1, L3_CONTEXT_ID, IP_V4_NETWORK_ADDRESS_1);
InstanceIdentifier<NetworkElements> neIid = InstanceIdentifier.builder(NetworkElements.class).build();
WriteTransaction wtx = dataBroker.newWriteOnlyTransaction();
wtx.put(LogicalDatastoreType.CONFIGURATION, neIid, nes);
wtx.submit().get();
AddressEndpoint endpoint =
InstanceIdentifier<NetworkElements> neIid = InstanceIdentifier.builder(NetworkElements.class).build();
WriteTransaction wtx = dataBroker.newWriteOnlyTransaction();
wtx.put(LogicalDatastoreType.CONFIGURATION, neIid, nes);
wtx.submit().get();
AddressEndpoint endpoint =
- createAddressEndpoint(IPv4_HOST_ADDRESS_1, IpPrefixType.class, L3_CONTEXT_ID, L3Context.class);
+ createAddressEndpoint(IP_V4_HOST_ADDRESS_1, IpPrefixType.class, L3_CONTEXT_ID, L3Context.class);
InstanceIdentifier<AddressEndpoint> iid = IidFactory.addressEndpointIid(endpoint.getKey());
wtx = dataBroker.newWriteOnlyTransaction();
wtx.put(LogicalDatastoreType.OPERATIONAL, iid, endpoint, true);
InstanceIdentifier<AddressEndpoint> iid = IidFactory.addressEndpointIid(endpoint.getKey());
wtx = dataBroker.newWriteOnlyTransaction();
wtx.put(LogicalDatastoreType.OPERATIONAL, iid, endpoint, true);
.setProvider(new ProviderName(NeLocationProvider.NE_LOCATION_PROVIDER_NAME))
.setProviderAddressEndpointLocation(Collections.singletonList(
new ProviderAddressEndpointLocationBuilder()
.setProvider(new ProviderName(NeLocationProvider.NE_LOCATION_PROVIDER_NAME))
.setProviderAddressEndpointLocation(Collections.singletonList(
new ProviderAddressEndpointLocationBuilder()
- .setAddress(IPv4_HOST_ADDRESS_1)
+ .setAddress(IP_V4_HOST_ADDRESS_1)
.setAddressType(IpPrefixType.class)
.setContextId(new ContextId(L3_CONTEXT_ID))
.setContextType(L3Context.class)
.setAddressType(IpPrefixType.class)
.setContextId(new ContextId(L3_CONTEXT_ID))
.setContextType(L3Context.class)
assertEquals(locationReference, locations);
}
assertEquals(locationReference, locations);
}
- private AddressEndpoint writeBaseAddrEndpoint () throws Exception {
+ private AddressEndpoint writeBaseAddrEndpoint() throws Exception {
AddressEndpoint endpoint =
AddressEndpoint endpoint =
- createAddressEndpoint(IPv4_HOST_ADDRESS_1, IpPrefixType.class, L3_CONTEXT_ID, L3Context.class);
+ createAddressEndpoint(IP_V4_HOST_ADDRESS_1, IpPrefixType.class, L3_CONTEXT_ID, L3Context.class);
InstanceIdentifier<AddressEndpoint> iid = IidFactory.addressEndpointIid(endpoint.getKey());
WriteTransaction wtx = dataBroker.newWriteOnlyTransaction();
wtx.put(LogicalDatastoreType.OPERATIONAL, iid, endpoint, true);
InstanceIdentifier<AddressEndpoint> iid = IidFactory.addressEndpointIid(endpoint.getKey());
WriteTransaction wtx = dataBroker.newWriteOnlyTransaction();
wtx.put(LogicalDatastoreType.OPERATIONAL, iid, endpoint, true);
- private NetworkElements writeBaseNetworkElements () throws Exception {
- NetworkElements nes = createNetworkElements(NODE_ID_1, CONNECTOR_ID_1, L3_CONTEXT_ID, IPv4_NETWORK_ADDRESS_1);
+ private NetworkElements writeBaseNetworkElements() throws Exception {
+ NetworkElements nes = createNetworkElements(NODE_ID_1, CONNECTOR_ID_1, L3_CONTEXT_ID, IP_V4_NETWORK_ADDRESS_1);
InstanceIdentifier<NetworkElements> iid = InstanceIdentifier.builder(NetworkElements.class).build();
WriteTransaction wtx = dataBroker.newWriteOnlyTransaction();
wtx.put(LogicalDatastoreType.CONFIGURATION, iid, nes);
InstanceIdentifier<NetworkElements> iid = InstanceIdentifier.builder(NetworkElements.class).build();
WriteTransaction wtx = dataBroker.newWriteOnlyTransaction();
wtx.put(LogicalDatastoreType.CONFIGURATION, iid, nes);
}
private AddressEndpoint createAddressEndpoint(String ipAddr, Class<? extends AddressType> addrType,
}
private AddressEndpoint createAddressEndpoint(String ipAddr, Class<? extends AddressType> addrType,
- String context, Class<? extends ContextType> cType) {
+ String context, Class<? extends ContextType> contextType) {
return new AddressEndpointBuilder()
.setAddress(ipAddr)
.setAddressType(addrType)
.setContextId(new ContextId(context))
return new AddressEndpointBuilder()
.setAddress(ipAddr)
.setAddressType(addrType)
.setContextId(new ContextId(context))
- .setContextType(cType).setTenant(TENANT)
+ .setContextType(contextType).setTenant(TENANT)
.setEndpointGroup(DEFAULT_EPG).build();
}
.setEndpointGroup(DEFAULT_EPG).build();
}
<scope>test</scope>
</dependency>
</dependencies>
<scope>test</scope>
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <excludes>org/opendaylight/yang/gen/**,**/yang/**</excludes>
+ <consoleOutput>true</consoleOutput>
+ <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ <phase>process-sources</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>