use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.network.instances.network.instance.protocols.protocol.bgp.neighbors.neighbor.state.messages.Received in project openflowplugin by opendaylight.
the class GroupFeaturesService method transformToNotification.
@Override
public GroupFeaturesUpdated transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
final int mpSize = result.size();
Preconditions.checkArgument(mpSize == 1, "unexpected (!=1) mp-reply size received: {}", mpSize);
GroupFeaturesUpdatedBuilder notification = new GroupFeaturesUpdatedBuilder();
notification.setId(getDeviceInfo().getNodeId());
notification.setMoreReplies(Boolean.FALSE);
notification.setTransactionId(emulatedTxId);
MultipartReplyGroupFeaturesCase caseBody = (MultipartReplyGroupFeaturesCase) result.get(0).getMultipartReplyBody();
MultipartReplyGroupFeatures replyBody = caseBody.getMultipartReplyGroupFeatures();
notification.setGroupTypesSupported(extractSupportedGroupTypes(replyBody.getTypes()));
notification.setMaxGroups(replyBody.getMaxGroups());
notification.setGroupCapabilitiesSupported(extractSupportedCapabilities(replyBody.getCapabilities()));
notification.setActions(GroupUtil.extractGroupActionsSupportBitmap(replyBody.getActionsBitmap()));
return notification.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.network.instances.network.instance.protocols.protocol.bgp.neighbors.neighbor.state.messages.Received in project openflowplugin by opendaylight.
the class LLDPDiscoveryUtils method lldpToNodeConnectorRef.
/**
* Returns the encoded in custom TLV for the given lldp.
*
* @param payload lldp payload
* @param useExtraAuthenticatorCheck make it more secure (CVE-2015-1611 CVE-2015-1612)
* @return nodeConnectorId - encoded in custom TLV of given lldp
*/
@SuppressWarnings("checkstyle:IllegalCatch")
public static NodeConnectorRef lldpToNodeConnectorRef(byte[] payload, boolean useExtraAuthenticatorCheck) {
NodeConnectorRef nodeConnectorRef = null;
if (isLLDP(payload)) {
Ethernet ethPkt = new Ethernet();
try {
ethPkt.deserialize(payload, 0, payload.length * NetUtils.NUM_BITS_IN_A_BYTE);
} catch (PacketException e) {
LOG.warn("Failed to decode LLDP packet {}", e);
return nodeConnectorRef;
}
LLDP lldp = (LLDP) ethPkt.getPayload();
try {
NodeId srcNodeId = null;
NodeConnectorId srcNodeConnectorId = null;
final LLDPTLV systemIdTLV = lldp.getSystemNameId();
if (systemIdTLV != null) {
String srcNodeIdString = new String(systemIdTLV.getValue(), Charset.defaultCharset());
srcNodeId = new NodeId(srcNodeIdString);
} else {
throw new Exception("Node id wasn't specified via systemNameId in LLDP packet.");
}
final LLDPTLV nodeConnectorIdLldptlv = lldp.getCustomTLV(LLDPTLV.createPortSubTypeCustomTLVKey());
if (nodeConnectorIdLldptlv != null) {
srcNodeConnectorId = new NodeConnectorId(LLDPTLV.getCustomString(nodeConnectorIdLldptlv.getValue(), nodeConnectorIdLldptlv.getLength()));
} else {
throw new Exception("Node connector wasn't specified via Custom TLV in LLDP packet.");
}
if (useExtraAuthenticatorCheck) {
boolean secure = checkExtraAuthenticator(lldp, srcNodeConnectorId);
if (!secure) {
LOG.warn("SECURITY ALERT: there is probably a LLDP spoofing attack in progress.");
throw new Exception("Attack. LLDP packet with inconsistent extra authenticator field was received.");
}
}
InstanceIdentifier<NodeConnector> srcInstanceId = InstanceIdentifier.builder(Nodes.class).child(Node.class, new NodeKey(srcNodeId)).child(NodeConnector.class, new NodeConnectorKey(srcNodeConnectorId)).toInstance();
nodeConnectorRef = new NodeConnectorRef(srcInstanceId);
} catch (Exception e) {
LOG.debug("Caught exception while parsing out lldp optional and custom fields", e);
}
}
return nodeConnectorRef;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.network.instances.network.instance.protocols.protocol.bgp.neighbors.neighbor.state.messages.Received in project lispflowmapping by opendaylight.
the class AuthenticationKeyDataListener method onDataTreeChanged.
@Override
public synchronized void onDataTreeChanged(Collection<DataTreeModification<AuthenticationKey>> changes) {
for (DataTreeModification<AuthenticationKey> change : changes) {
final DataObjectModification<AuthenticationKey> mod = change.getRootNode();
if (ModificationType.DELETE == mod.getModificationType()) {
final AuthenticationKey authKey = mod.getDataBefore();
LOG.trace("Received deleted data");
LOG.trace("Key: {}", change.getRootPath().getRootIdentifier());
LOG.trace("Value: {}", authKey);
final AuthenticationKey convertedAuthKey = convertToBinaryIfNecessary(authKey);
akdb.removeAuthenticationKey(convertedAuthKey.getEid());
updatedEntries.put(convertedAuthKey.getEid(), System.currentTimeMillis());
} else if (ModificationType.WRITE == mod.getModificationType() || ModificationType.SUBTREE_MODIFIED == mod.getModificationType()) {
if (ModificationType.WRITE == mod.getModificationType()) {
LOG.trace("Received created data");
} else {
LOG.trace("Received updated data");
}
// Process newly created or updated authentication keys
final AuthenticationKey authKey = mod.getDataAfter();
LOG.trace("Key: {}", change.getRootPath().getRootIdentifier());
LOG.trace("Value: {}", authKey);
final AuthenticationKey convertedAuthKey = convertToBinaryIfNecessary(authKey);
akdb.addAuthenticationKey(convertedAuthKey.getEid(), convertedAuthKey.getMappingAuthkey());
updatedEntries.put(convertedAuthKey.getEid(), System.currentTimeMillis());
} else {
LOG.warn("Ignoring unhandled modification type {}", mod.getModificationType());
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.network.instances.network.instance.protocols.protocol.bgp.neighbors.neighbor.state.messages.Received in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTestUtil method getDefaultMapRequestBuilder.
/*
* PACKETS CREATION METHODS
*
* In general we return "Builders" so that the caller can customize the fields, but that means it also needs to
* call .build() on the received objects.
*/
/* Map-Request */
/**
* Create a default MapRequestBuilder object.
*
* @param eid the requested EID
* @return the MapRequestBuilder object
*/
static MapRequestBuilder getDefaultMapRequestBuilder(Eid eid) {
MapRequestBuilder mrBuilder = new MapRequestBuilder().setAuthoritative(false).setEidItem(new ArrayList<>()).setItrRloc(new ArrayList<>()).setMapDataPresent(true).setNonce((long) 4).setPitr(false).setProbe(false).setSmr(false).setSmrInvoked(false).setSourceEid(new SourceEidBuilder().setEid(DEFAULT_IPV4_EID).build()).setItrRloc(getDefaultItrRlocList(DEFAULT_IPV4_ITR_RLOC));
mrBuilder.getEidItem().add(new EidItemBuilder().setEid(eid).build());
return mrBuilder;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.network.instances.network.instance.protocols.protocol.bgp.neighbors.neighbor.state.messages.Received in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTestUtil method getDefaultMappingRecordBuilder.
/**
* Create a default MappingRecordBuilder object.
*
* @param eid EID for the mapping record, if null, a default will be added
* @param rlocs RLOCs for the mapping record, if null, no locator record will be added
* @return the MappingRecordBuilder object
*/
static MappingRecordBuilder getDefaultMappingRecordBuilder(Eid eid, List<Rloc> rlocs) {
if (eid == null) {
eid = DEFAULT_IPV4_EID_PREFIX;
LOG.warn("getDefaultMappingRecordBuilder(): null EID received, using the default {}", DEFAULT_IPV4_EID_STRING);
}
MappingRecordBuilder mrb = new MappingRecordBuilder().setEid(eid).setAction(MappingRecord.Action.NoAction).setAuthoritative(false).setLocatorRecord(new ArrayList<>()).setMapVersion((short) 0).setRecordTtl(60).setSiteId(DEFAULT_SITE_ID).setXtrId(DEFAULT_XTR_ID).setTimestamp(System.currentTimeMillis());
// We want to allow for empty locator records, so we only add one if rloc is not null
if (rlocs != null) {
for (Rloc rloc : rlocs) {
mrb.getLocatorRecord().add(getDefaultLocatorBuilder(rloc).build());
}
}
return mrb;
}
Aggregations