use of org.snakeyaml.engine.v2.nodes.Node in project genius by opendaylight.
the class MDSALManager method buildDpnNode.
protected Node buildDpnNode(BigInteger dpnId) {
NodeId nodeId = new NodeId("openflow:" + dpnId);
Node nodeDpn = new NodeBuilder().setId(nodeId).setKey(new NodeKey(nodeId)).build();
return nodeDpn;
}
use of org.snakeyaml.engine.v2.nodes.Node in project netvirt by opendaylight.
the class VrfEntryListener method createTerminatingServiceActions.
public void createTerminatingServiceActions(Uint64 destDpId, Uint32 label, List<ActionInfo> actionsInfos, TypedWriteTransaction<Configuration> tx) {
List<MatchInfo> mkMatches = new ArrayList<>();
LOG.debug("create terminatingServiceAction on DpnId = {} and serviceId = {} and actions = {}", destDpId, label, actionsInfos);
// Matching metadata
// FIXME vxlan vni bit set is not working properly with OVS.need to revisit
mkMatches.add(new MatchTunnelId(Uint64.valueOf(label.longValue())));
List<InstructionInfo> mkInstructions = new ArrayList<>();
mkInstructions.add(new InstructionApplyActions(actionsInfos));
FlowEntity terminatingServiceTableFlowEntity = MDSALUtil.buildFlowEntity(destDpId, NwConstants.INTERNAL_TUNNEL_TABLE, getTableMissFlowRef(destDpId, NwConstants.INTERNAL_TUNNEL_TABLE, label), FibConstants.DEFAULT_VPN_INTERNAL_TUNNEL_TABLE_PRIORITY, String.format("%s:%s", "TST Flow Entry ", label), 0, 0, Uint64.valueOf(COOKIE_TUNNEL.longValue() + label.longValue()), mkMatches, mkInstructions);
FlowKey flowKey = new FlowKey(new FlowId(terminatingServiceTableFlowEntity.getFlowId()));
FlowBuilder flowbld = terminatingServiceTableFlowEntity.getFlowBuilder();
Node nodeDpn = FibUtil.buildDpnNode(terminatingServiceTableFlowEntity.getDpnId());
InstanceIdentifier<Flow> flowInstanceId = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeDpn.key()).augmentation(FlowCapableNode.class).child(Table.class, new TableKey(terminatingServiceTableFlowEntity.getTableId())).child(Flow.class, flowKey).build();
tx.mergeParentStructurePut(flowInstanceId, flowbld.build());
}
use of org.snakeyaml.engine.v2.nodes.Node in project netvirt by opendaylight.
the class VrfEntryListener method programRemoteFibWithLoadBalancingGroups.
// Allow deprecated TransactionRunner calls for now
@SuppressWarnings("ForbidCertainMethod")
private void programRemoteFibWithLoadBalancingGroups(final Uint64 remoteDpnId, final Uint32 vpnId, String rd, final VrfEntry vrfEntry, List<Routes> vpnExtraRoutes) {
// create loadbalancing groups for extra routes only when the extra route is
// present behind multiple VMs
// Obtain the local routes for this particular dpn.
java.util.Optional<Routes> routes = vpnExtraRoutes.stream().filter(route -> {
Prefixes prefixToInterface = fibUtil.getPrefixToInterface(vpnId, FibUtil.getIpPrefix(route.getNexthopIpList().get(0)));
if (prefixToInterface == null) {
return false;
}
return remoteDpnId.equals(prefixToInterface.getDpnId());
}).findFirst();
long groupId = nextHopManager.createNextHopGroups(vpnId, rd, remoteDpnId, vrfEntry, routes.isPresent() ? routes.get() : null, vpnExtraRoutes);
if (groupId == FibConstants.INVALID_GROUP_ID) {
LOG.error("Unable to create Group for local prefix {} on rd {} on Node {}", vrfEntry.getDestPrefix(), rd, remoteDpnId);
return;
}
List<ActionInfo> actionInfos = Collections.singletonList(new ActionGroup(groupId));
List<InstructionInfo> instructions = Lists.newArrayList(new InstructionApplyActions(actionInfos));
String jobKey = FibUtil.getCreateRemoteNextHopJobKey(vpnId, remoteDpnId, vrfEntry.getDestPrefix());
jobCoordinator.enqueueJob(jobKey, () -> Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(Datastore.CONFIGURATION, txn -> {
baseVrfEntryHandler.makeConnectedRoute(remoteDpnId, vpnId, vrfEntry, rd, instructions, NwConstants.ADD_FLOW, TransactionAdapter.toWriteTransaction(txn), null);
})));
LOG.debug("Successfully added FIB entry for prefix {} in vpnId {}", vrfEntry.getDestPrefix(), vpnId);
}
use of org.snakeyaml.engine.v2.nodes.Node in project netvirt by opendaylight.
the class Ipv6PktHandlerTest method testonPacketReceivedNeighborAdvertisementWithValidPayload.
@Test
public void testonPacketReceivedNeighborAdvertisementWithValidPayload() throws Exception {
VirtualPort intf = Mockito.mock(VirtualPort.class);
when(intf.getNetworkID()).thenReturn(new Uuid("eeec9dba-d831-4ad7-84b9-00d7f65f0555"));
when(ifMgrInstance.getInterfaceNameFromTag(anyLong())).thenReturn("ddec9dba-d831-4ad7-84b9-00d7f65f052f");
when(ifMgrInstance.obtainV6Interface(any())).thenReturn(intf);
InstanceIdentifier<Node> ncId = InstanceIdentifier.builder(Nodes.class).child(Node.class, new NodeKey(new NodeId("openflow:1"))).build();
NodeConnectorRef ncRef = new NodeConnectorRef(ncId);
Uint64 mdata = Uint64.valueOf(0x1000000);
Metadata metadata = new MetadataBuilder().setMetadata(mdata).build();
MatchBuilder matchbuilder = new MatchBuilder().setMetadata(metadata);
byte[] data = ipv6TestUtils.buildPacket(// Destination MAC
"FA 16 3E F7 69 4E", // Source MAC
"FA 16 3E A9 38 94", // IPv6
"86 DD", // Version 6, traffic class 0, no flowlabel
"60 00 00 00", // Payload length
"00 20", // Next header is ICMPv6
"3A", // Hop limit
"FF", // Source IP
"20 01 0D B8 00 00 00 02 00 00 00 00 00 00 11 11", // Destination IP
"10 01 0D B8 00 00 00 02 F8 16 3E FF FE F7 69 4E", // ICMPv6 neighbor advertisement
"88", // Code
"00", // Checksum (valid)
"C9 9F", // ICMPv6 message body
"00 00 00 00", // Target
"20 01 0D B8 00 00 00 02 00 00 00 00 00 00 11 11", // ICMPv6 Option: Target Link Layer Address
"02", // Length
"01", // Link Layer Address
"FA 16 3E A9 38 94");
pktHandler.onPacketReceived(new PacketReceivedBuilder().setPayload(data).setIngress(ncRef).setMatch(matchbuilder.build()).setTableId(new TableId((short) 45)).build());
// wait on this thread until the async job is completed in the packet handler.
waitForPacketProcessing();
NeighborAdvertisePacket naPdu = new Ipv6NaDecoder(data).decode();
NeighborAdvertisePacket naPacket = new NeighborAdvertisePacketBuilder(naPdu).addAugmentation(new PacketMetadataBuilder().setOfTableId((long) 45).setMetadata(mdata).setInterface("ddec9dba-d831-4ad7-84b9-00d7f65f052f").build()).build();
verify(ipv6PktListener).onNaReceived(naPacket);
}
use of org.snakeyaml.engine.v2.nodes.Node in project netvirt by opendaylight.
the class NaptEventHandler method getFlowRef.
public static FlowRef getFlowRef(Uint64 dpId, Flow flow) {
FlowKey flowKey = new FlowKey(new FlowId(flow.getId()));
Node nodeDpn = buildInventoryDpnNode(dpId);
InstanceIdentifier<Flow> flowInstanceId = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeDpn.key()).augmentation(FlowCapableNode.class).child(Table.class, new TableKey(flow.getTableId())).child(Flow.class, flowKey).build();
return new FlowRef(flowInstanceId);
}
Aggregations