use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.Dscp in project openflowplugin by opendaylight.
the class FlowListenerTest method updateFlowScopeTest.
@Test
public void updateFlowScopeTest() throws Exception {
addFlowCapableNode(NODE_KEY);
FlowKey flowKey = new FlowKey(new FlowId("test_Flow"));
InstanceIdentifier<Table> tableII = InstanceIdentifier.create(Nodes.class).child(Node.class, NODE_KEY).augmentation(FlowCapableNode.class).child(Table.class, tableKey);
InstanceIdentifier<Flow> flowII = InstanceIdentifier.create(Nodes.class).child(Node.class, NODE_KEY).augmentation(FlowCapableNode.class).child(Table.class, tableKey).child(Flow.class, flowKey);
Table table = new TableBuilder().setKey(tableKey).setFlow(Collections.<Flow>emptyList()).build();
IpMatch ipMatch = new IpMatchBuilder().setIpDscp(new Dscp((short) 4)).build();
Match match = new MatchBuilder().setIpMatch(ipMatch).build();
Flow flow = new FlowBuilder().setMatch(match).setKey(flowKey).setTableId((short) 2).build();
WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.CONFIGURATION, tableII, table);
writeTx.put(LogicalDatastoreType.CONFIGURATION, flowII, flow);
assertCommit(writeTx.submit());
SalFlowServiceMock salFlowService = (SalFlowServiceMock) forwardingRulesManager.getSalFlowService();
List<AddFlowInput> addFlowCalls = salFlowService.getAddFlowCalls();
assertEquals(1, addFlowCalls.size());
assertEquals("DOM-0", addFlowCalls.get(0).getTransactionUri().getValue());
flowKey = new FlowKey(new FlowId("test_Flow"));
flowII = InstanceIdentifier.create(Nodes.class).child(Node.class, NODE_KEY).augmentation(FlowCapableNode.class).child(Table.class, tableKey).child(Flow.class, flowKey);
ipMatch = new IpMatchBuilder().setIpDscp(new Dscp((short) 5)).build();
match = new MatchBuilder().setIpMatch(ipMatch).build();
flow = new FlowBuilder().setMatch(match).setKey(flowKey).setTableId((short) 2).build();
writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.CONFIGURATION, flowII, flow);
assertCommit(writeTx.submit());
salFlowService = (SalFlowServiceMock) forwardingRulesManager.getSalFlowService();
List<UpdateFlowInput> updateFlowCalls = salFlowService.getUpdateFlowCalls();
assertEquals(1, updateFlowCalls.size());
assertEquals("DOM-1", updateFlowCalls.get(0).getTransactionUri().getValue());
assertEquals(flowII, updateFlowCalls.get(0).getFlowRef().getValue());
assertEquals(ipMatch, updateFlowCalls.get(0).getUpdatedFlow().getMatch().getIpMatch());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.Dscp in project openflowplugin by opendaylight.
the class IpDscpEntrySerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final short dscp = (short) 58;
final Match match = new MatchBuilder().setIpMatch(new IpMatchBuilder().setIpDscp(new Dscp(dscp)).build()).build();
assertMatch(match, false, (out) -> assertEquals(out.readUnsignedByte(), dscp));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.Dscp in project openflowplugin by opendaylight.
the class OxmIpDscpDeserializer method addIpDscpValue.
private static void addIpDscpValue(ByteBuf input, MatchEntryBuilder builder) {
IpDscpCaseBuilder caseBuilder = new IpDscpCaseBuilder();
IpDscpBuilder dscpBuilder = new IpDscpBuilder();
dscpBuilder.setDscp(new Dscp(input.readUnsignedByte()));
caseBuilder.setIpDscp(dscpBuilder.build());
builder.setMatchEntryValue(caseBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.Dscp in project netvirt by opendaylight.
the class QosNeutronUtils method handleNeutronPortRemove.
public void handleNeutronPortRemove(Port port, Uuid qosUuid) {
LOG.debug("Handling Port removal and Qos associated: port: {} qos: {}", port.getUuid().getValue(), qosUuid.getValue());
QosPolicy qosPolicy = qosPolicyMap.get(qosUuid);
jobCoordinator.enqueueJob("QosPort-" + port.getUuid().getValue(), () -> {
// check if any DSCP rule in the policy
if (qosPolicy != null && qosPolicy.getDscpmarkingRules() != null && !qosPolicy.getDscpmarkingRules().isEmpty()) {
unsetPortDscpMark(port);
}
return emptyList();
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.Dscp in project netvirt by opendaylight.
the class QosNeutronUtils method handleNeutronNetworkQosDscpRuleRemove.
public void handleNeutronNetworkQosDscpRuleRemove(Network network) {
LOG.debug("Handling Qos Dscp Rule Remove, net: {}", network.getUuid().getValue());
List<Uuid> subnetIds = getSubnetIdsFromNetworkId(network.getUuid());
for (Uuid subnetId : subnetIds) {
List<Uuid> portIds = getPortIdsFromSubnetId(subnetId);
for (Uuid portId : portIds) {
Port port = getNeutronPort(portId);
if (port != null && (port.augmentation(QosPortExtension.class) == null || port.augmentation(QosPortExtension.class).getQosPolicyId() == null)) {
jobCoordinator.enqueueJob("QosPort-" + portId.getValue(), () -> {
unsetPortDscpMark(port);
return emptyList();
});
}
}
}
}
Aggregations