use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.Update in project netvirt by opendaylight.
the class QosPolicyChangeListener method update.
private void update(InstanceIdentifier<DscpmarkingRules> identifier, DscpmarkingRules original, DscpmarkingRules update) {
LOG.trace("Updating DscpMarkingRules : key: {}, original value={}, update value={}", identifier, original, update);
Uuid qosUuid = identifier.firstKeyOf(QosPolicy.class).getUuid();
update(qosUuid, update);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.Update in project netvirt by opendaylight.
the class QosPolicyChangeListener method update.
private void update(Uuid qosUuid, DscpmarkingRules update) {
for (Network network : qosNeutronUtils.getQosNetworks(qosUuid)) {
qosNeutronUtils.handleNeutronNetworkQosUpdate(network, qosUuid);
}
for (Port port : qosNeutronUtils.getQosPorts(qosUuid)) {
jobCoordinator.enqueueJob("QosPort-" + port.getUuid().getValue(), () -> {
WriteTransaction wrtConfigTxn = dataBroker.newWriteOnlyTransaction();
List<ListenableFuture<Void>> futures = new ArrayList<>();
qosNeutronUtils.setPortDscpMarking(port, update);
futures.add(wrtConfigTxn.submit());
return futures;
});
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.Update in project netvirt by opendaylight.
the class L2GatewayListener method update.
@Override
protected void update(InstanceIdentifier<L2gateway> identifier, L2gateway original, L2gateway update) {
LOG.trace("Updating L2gateway : key: {}, original value={}, update value={}", identifier, original, update);
List<L2gatewayConnection> connections = l2gwService.getAssociatedL2GwConnections(Sets.newHashSet(update.getUuid()));
if (connections == null) {
LOG.warn("There are no connections associated with l2 gateway uuid {} name {}", update.getUuid(), update.getName());
return;
}
if (original.getDevices() == null) {
connections.forEach((connection) -> l2gwService.addL2GatewayConnection(connection));
return;
}
jobCoordinator.enqueueJob("l2gw.update", () -> {
ReadWriteTransaction transaction = dataBroker.newReadWriteTransaction();
DeviceInterfaces updatedDeviceInterfaces = new DeviceInterfaces(update);
List<ListenableFuture<Void>> fts = new ArrayList<>();
original.getDevices().stream().filter((originalDevice) -> originalDevice.getInterfaces() != null).forEach((originalDevice) -> {
String deviceName = originalDevice.getDeviceName();
L2GatewayDevice l2GwDevice = l2GatewayCache.get(deviceName);
NodeId physicalSwitchNodeId = HwvtepSouthboundUtils.createManagedNodeId(new NodeId(l2GwDevice.getHwvtepNodeId()), deviceName);
originalDevice.getInterfaces().stream().filter((intf) -> !updatedDeviceInterfaces.containsInterface(deviceName, intf.getInterfaceName())).forEach((intf) -> {
connections.forEach((connection) -> {
Integer vlanId = connection.getSegmentId();
if (intf.getSegmentationIds() != null && !intf.getSegmentationIds().isEmpty()) {
for (Integer vlan : intf.getSegmentationIds()) {
HwvtepUtils.deleteVlanBinding(transaction, physicalSwitchNodeId, intf.getInterfaceName(), vlan);
}
} else {
LOG.debug("Deleting vlan binding {} {} {}", physicalSwitchNodeId, intf.getInterfaceName(), vlanId);
HwvtepUtils.deleteVlanBinding(transaction, physicalSwitchNodeId, intf.getInterfaceName(), vlanId);
}
});
});
});
fts.add(transaction.submit());
Futures.addCallback(fts.get(0), new FutureCallback<Void>() {
@Override
public void onSuccess(Void success) {
LOG.debug("Successfully deleted vlan bindings for l2gw update {}", update);
connections.forEach((l2GwConnection) -> l2gwService.addL2GatewayConnection(l2GwConnection, null, update));
}
@Override
public void onFailure(Throwable throwable) {
LOG.error("Failed to delete vlan bindings as part of l2gw udpate {}", update);
}
}, MoreExecutors.directExecutor());
return fts;
}, SystemPropertyReader.getDataStoreJobCoordinatorMaxRetries());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.Update in project openflowplugin by opendaylight.
the class SyncPlanPushStrategyIncrementalImplTest method testAddMissingFlows_withUpdate.
@Test
public void testAddMissingFlows_withUpdate() throws Exception {
Mockito.when(flowCommitter.add(Matchers.<InstanceIdentifier<Flow>>any(), flowCaptor.capture(), Matchers.same(NODE_IDENT))).thenReturn(RpcResultBuilder.success(new AddFlowOutputBuilder().build()).buildFuture());
Mockito.when(flowCommitter.update(Matchers.<InstanceIdentifier<Flow>>any(), flowUpdateCaptor.capture(), flowUpdateCaptor.capture(), Matchers.same(NODE_IDENT))).thenReturn(RpcResultBuilder.success(new UpdateFlowOutputBuilder().build()).buildFuture());
final ItemSyncBox<Flow> flowBox = new ItemSyncBox<>();
flowBox.getItemsToPush().add(DSInputFactory.createFlow("f3", 3));
flowBox.getItemsToPush().add(DSInputFactory.createFlow("f4", 4));
flowBox.getItemsToUpdate().add(new ItemSyncBox.ItemUpdateTuple<>(DSInputFactory.createFlow("f1", 1), DSInputFactory.createFlowWithInstruction("f1", 1)));
final Map<TableKey, ItemSyncBox<Flow>> flowBoxMap = new LinkedHashMap<>();
flowBoxMap.put(new TableKey((short) 0), flowBox);
// TODO: replace null
final ListenableFuture<RpcResult<Void>> result = syncPlanPushStrategy.addMissingFlows(NODE_ID, NODE_IDENT, flowBoxMap, counters);
Assert.assertTrue(result.isDone());
Assert.assertTrue(result.get().isSuccessful());
final List<Flow> flowCaptorAllValues = flowCaptor.getAllValues();
Assert.assertEquals(2, flowCaptorAllValues.size());
Assert.assertEquals("f3", flowCaptorAllValues.get(0).getId().getValue());
Assert.assertEquals("f4", flowCaptorAllValues.get(1).getId().getValue());
final List<Flow> flowUpdateCaptorAllValues = flowUpdateCaptor.getAllValues();
Assert.assertEquals(2, flowUpdateCaptorAllValues.size());
Assert.assertEquals("f1", flowUpdateCaptorAllValues.get(0).getId().getValue());
Assert.assertEquals("f1", flowUpdateCaptorAllValues.get(1).getId().getValue());
final InOrder inOrderFlow = Mockito.inOrder(flowCapableTxService, flowCommitter);
// add f3, f4
inOrderFlow.verify(flowCommitter, Mockito.times(2)).add(Matchers.<InstanceIdentifier<Flow>>any(), Matchers.<Flow>any(), Matchers.eq(NODE_IDENT));
// update f1
inOrderFlow.verify(flowCommitter).update(Matchers.<InstanceIdentifier<Flow>>any(), Matchers.<Flow>any(), Matchers.<Flow>any(), Matchers.eq(NODE_IDENT));
// TODO: uncomment when enabled in impl
// inOrderFlow.verify(flowCapableTxService).sendBarrier(Matchers.<SendBarrierInput>any());
inOrderFlow.verifyNoMoreInteractions();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.Update in project openflowplugin by opendaylight.
the class SyncPlanPushStrategyIncrementalImplTest method setUp.
@Before
public void setUp() throws Exception {
Mockito.when(flowCapableTxService.sendBarrier(Matchers.<SendBarrierInput>any())).thenReturn(RpcResultBuilder.success((Void) null).buildFuture());
Mockito.doAnswer(createSalServiceFutureAnswer()).when(groupCommitter).add(Matchers.<InstanceIdentifier<Group>>any(), Matchers.<Group>any(), Matchers.<InstanceIdentifier<FlowCapableNode>>any());
Mockito.doAnswer(createSalServiceFutureAnswer()).when(groupCommitter).update(Matchers.<InstanceIdentifier<Group>>any(), Matchers.<Group>any(), Matchers.<Group>any(), Matchers.<InstanceIdentifier<FlowCapableNode>>any());
Mockito.doAnswer(createSalServiceFutureAnswer()).when(groupCommitter).remove(Matchers.<InstanceIdentifier<Group>>any(), Matchers.<Group>any(), Matchers.<InstanceIdentifier<FlowCapableNode>>any());
Mockito.doAnswer(createSalServiceFutureAnswer()).when(flowCommitter).add(Matchers.<InstanceIdentifier<Flow>>any(), Matchers.<Flow>any(), Matchers.<InstanceIdentifier<FlowCapableNode>>any());
Mockito.doAnswer(createSalServiceFutureAnswer()).when(flowCommitter).update(Matchers.<InstanceIdentifier<Flow>>any(), Matchers.<Flow>any(), Matchers.<Flow>any(), Matchers.<InstanceIdentifier<FlowCapableNode>>any());
Mockito.doAnswer(createSalServiceFutureAnswer()).when(flowCommitter).remove(Matchers.<InstanceIdentifier<Flow>>any(), Matchers.<Flow>any(), Matchers.<InstanceIdentifier<FlowCapableNode>>any());
Mockito.doAnswer(createSalServiceFutureAnswer()).when(meterCommitter).add(Matchers.<InstanceIdentifier<Meter>>any(), Matchers.<Meter>any(), Matchers.<InstanceIdentifier<FlowCapableNode>>any());
Mockito.doAnswer(createSalServiceFutureAnswer()).when(meterCommitter).update(Matchers.<InstanceIdentifier<Meter>>any(), Matchers.<Meter>any(), Matchers.<Meter>any(), Matchers.<InstanceIdentifier<FlowCapableNode>>any());
Mockito.doAnswer(createSalServiceFutureAnswer()).when(meterCommitter).remove(Matchers.<InstanceIdentifier<Meter>>any(), Matchers.<Meter>any(), Matchers.<InstanceIdentifier<FlowCapableNode>>any());
Mockito.doAnswer(createSalServiceFutureAnswer()).when(tableCommitter).update(Matchers.<InstanceIdentifier<TableFeatures>>any(), Matchers.<TableFeatures>any(), Matchers.<TableFeatures>any(), Matchers.<InstanceIdentifier<FlowCapableNode>>any());
syncPlanPushStrategy = new SyncPlanPushStrategyIncrementalImpl().setMeterForwarder(meterCommitter).setTableForwarder(tableCommitter).setGroupForwarder(groupCommitter).setFlowForwarder(flowCommitter).setTransactionService(flowCapableTxService);
counters = new SyncCrudCounters();
}
Aggregations