- /**
- * Create the updated {@link RegisterEndpointInput}, using the existing
- * {@link Endpoint} and the new OfOverlay augmentation information (i.e.
- * port name, NodeId, and NodeConnectorId).
- *
- * @param ep The existing {@link Endpoint} state
- * @param portName The new port name in the OfOverlay augmentation
- * @param nodeIdString The new NodeId in the OfOverlay augmentation
- * @param nodeConnectorIdString The new NodeConnectorId in the OfOverlay augmentation
- * @return The new {@link RegisterEndpointInput}, null if failure
- */
- public static RegisterEndpointInput createRegisterEndpointInput(Endpoint ep,
- String portName, String nodeIdString, String nodeConnectorIdString) {
-
- org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId invNodeId =
- new org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId(nodeIdString);
- org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId ncId =
- new org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId(nodeConnectorIdString);
-
- RegisterEndpointInputBuilder inputBuilder = new RegisterEndpointInputBuilder().setL2Context(
- ep.getL2Context())
- .setMacAddress(new MacAddress(ep.getMacAddress()))
- .setTenant(new TenantId(ep.getTenant()))
- .setEndpointGroups(ep.getEndpointGroups())
- .addAugmentation(OfOverlayContextInput.class,
- new OfOverlayContextInputBuilder()
- .setPortName(new Name(portName))
- .setNodeId(invNodeId)
- .setNodeConnectorId(ncId)
- .build())
- .setTimestamp(System.currentTimeMillis());
-
- // TODO Li msunal this getting of just first IP has to be rewrite when OFOverlay renderer
- // will support l3-endpoints. Then we will register L2 and L3 endpoints separately.
- if (ep.getNetworkContainment() != null) {
- inputBuilder.setNetworkContainment(new SubnetId(ep.getNetworkContainment()));
- L3Address l3Address = new L3AddressBuilder()
- .setIpAddress(ep.getL3Address().get(0).getIpAddress())
- .setL3Context(ep.getL3Address().get(0).getL3Context())
- .build();
- inputBuilder.setL3Address(ImmutableList.of(l3Address));
- }
- return inputBuilder.build();
+ public static void updateEndpointRemoveLocation(Endpoint endpoint, ReadWriteTransaction rwTx) {
+ EndpointBuilder epBuilder = new EndpointBuilder(endpoint);
+ Endpoint newEp = epBuilder.build();
+ epBuilder.removeAugmentation(OfOverlayContext.class);
+ rwTx.put(LogicalDatastoreType.OPERATIONAL, IidFactory.endpointIid(newEp.getL2Context(), newEp.getMacAddress()),
+ newEp);
+ DataStoreHelper.submitToDs(rwTx);