use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Metadata in project genius by opendaylight.
the class ArpUtilImpl method onPacketReceived.
@Override
public void onPacketReceived(PacketReceived packetReceived) {
Class<? extends PacketInReason> pktInReason = packetReceived.getPacketInReason();
LOG.trace("Packet Received {}", packetReceived);
if (pktInReason == SendToController.class) {
try {
int tableId = packetReceived.getTableId().getValue();
byte[] data = packetReceived.getPayload();
Ethernet ethernet = new Ethernet();
ethernet.deserialize(data, 0, data.length * NetUtils.NUM_BITS_IN_A_BYTE);
if (ethernet.getEtherType() != ArpConstants.ETH_TYPE_ARP) {
return;
}
Packet pkt = ethernet.getPayload();
ARP arp = (ARP) pkt;
InetAddress srcInetAddr = InetAddress.getByAddress(arp.getSenderProtocolAddress());
InetAddress dstInetAddr = InetAddress.getByAddress(arp.getTargetProtocolAddress());
byte[] srcMac = ethernet.getSourceMACAddress();
byte[] dstMac = ethernet.getDestinationMACAddress();
Metadata metadata = packetReceived.getMatch().getMetadata();
String interfaceName = getInterfaceName(metadata);
checkAndFireMacChangedNotification(interfaceName, srcInetAddr, srcMac);
macsDB.put(interfaceName + "-" + srcInetAddr.getHostAddress(), NWUtil.toStringMacAddress(srcMac));
if (arp.getOpCode() == ArpConstants.ARP_REQUEST_OP) {
fireArpReqRecvdNotification(interfaceName, srcInetAddr, srcMac, dstInetAddr, tableId, metadata.getMetadata());
} else {
fireArpRespRecvdNotification(interfaceName, srcInetAddr, srcMac, tableId, metadata.getMetadata(), dstInetAddr, dstMac);
}
if (macAddrs.get(srcInetAddr.getHostAddress()) != null) {
threadPool.execute(new MacResponderTask(arp));
}
} catch (PacketException | UnknownHostException | InterruptedException | ExecutionException e) {
LOG.trace("Failed to decode packet", e);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Metadata in project cxf by apache.
the class AbstractSTSClient method configureViaEPR.
public void configureViaEPR(EndpointReferenceType ref, boolean useEPRWSAAddrAsMEXLocation) {
if (client != null) {
return;
}
location = EndpointReferenceUtils.getAddress(ref);
if (location != null) {
location = location.trim();
}
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("EPR address: " + location);
}
final QName sName = EndpointReferenceUtils.getServiceName(ref, bus);
if (sName != null) {
serviceName = sName;
final QName epName = EndpointReferenceUtils.getPortQName(ref, bus);
if (epName != null) {
endpointName = epName;
}
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("EPR endpoint: " + serviceName + " " + endpointName);
}
}
final String wsdlLoc = EndpointReferenceUtils.getWSDLLocation(ref);
if (wsdlLoc != null) {
wsdlLocation = wsdlLoc;
}
String mexLoc = findMEXLocation(ref, useEPRWSAAddrAsMEXLocation);
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("WS-MEX location: " + mexLoc);
}
if (mexLoc != null) {
try {
JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
proxyFac.setBindingId(soapVersion);
proxyFac.setAddress(mexLoc);
MetadataExchange exc = proxyFac.create(MetadataExchange.class);
Metadata metadata = exc.get2004();
Definition definition = null;
List<Schema> schemas = new ArrayList<>();
// Parse the MetadataSections into WSDL definition + associated schemas
for (MetadataSection s : metadata.getMetadataSection()) {
if ("http://schemas.xmlsoap.org/wsdl/".equals(s.getDialect())) {
definition = bus.getExtension(WSDLManager.class).getDefinition((Element) s.getAny());
} else if ("http://www.w3.org/2001/XMLSchema".equals(s.getDialect())) {
Element schemaElement = (Element) s.getAny();
if (schemaElement == null) {
String schemaLocation = s.getLocation();
LOG.info("XSD schema location: " + schemaLocation);
schemaElement = downloadSchema(schemaLocation);
}
QName schemaName = new QName(schemaElement.getNamespaceURI(), schemaElement.getLocalName());
WSDLManager wsdlManager = bus.getExtension(WSDLManager.class);
ExtensibilityElement exElement = wsdlManager.getExtensionRegistry().createExtension(Types.class, schemaName);
((Schema) exElement).setElement(schemaElement);
schemas.add((Schema) exElement);
}
}
if (definition != null) {
// Add any extra schemas to the WSDL definition
for (Schema schema : schemas) {
definition.getTypes().addExtensibilityElement(schema);
}
WSDLServiceFactory factory = new WSDLServiceFactory(bus, definition);
SourceDataBinding dataBinding = new SourceDataBinding();
factory.setDataBinding(dataBinding);
Service service = factory.create();
service.setDataBinding(dataBinding);
// Get the endpoint + service names by matching the 'location' to the
// address in the WSDL. If the 'location' is 'anonymous' then just fall
// back to the first service + endpoint name in the WSDL, if the endpoint
// name is not defined in the Metadata
List<ServiceInfo> services = service.getServiceInfos();
String anonymousAddress = "http://www.w3.org/2005/08/addressing/anonymous";
if (!anonymousAddress.equals(location)) {
for (ServiceInfo serv : services) {
for (EndpointInfo ei : serv.getEndpoints()) {
if (ei.getAddress().equals(location)) {
endpointName = ei.getName();
serviceName = serv.getName();
LOG.fine("Matched endpoint to location");
}
}
}
}
EndpointInfo ei = service.getEndpointInfo(endpointName);
if (ei == null && anonymousAddress.equals(location) && !services.isEmpty() && !services.get(0).getEndpoints().isEmpty()) {
LOG.fine("Anonymous location so taking first endpoint");
serviceName = services.get(0).getName();
endpointName = services.get(0).getEndpoints().iterator().next().getName();
ei = service.getEndpointInfo(endpointName);
}
if (ei == null) {
throw new TrustException(LOG, "ADDRESS_NOT_MATCHED", location);
}
if (location != null && !anonymousAddress.equals(location)) {
ei.setAddress(location);
}
Endpoint endpoint = new EndpointImpl(bus, service, ei);
client = new ClientImpl(bus, endpoint);
}
} catch (Exception ex) {
throw new TrustException("WS_MEX_ERROR", ex, LOG);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Metadata in project cxf by apache.
the class MEXTest method testGet.
@Test
public void testGet() {
// Create the client
JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
proxyFac.setBus(getStaticBus());
proxyFac.setAddress("http://localhost:" + PORT + "/jaxws/addmex");
proxyFac.getFeatures().add(new LoggingFeature());
MetadataExchange exc = proxyFac.create(MetadataExchange.class);
Metadata metadata = exc.get2004();
assertNotNull(metadata);
assertEquals(2, metadata.getMetadataSection().size());
assertEquals("http://schemas.xmlsoap.org/wsdl/", metadata.getMetadataSection().get(0).getDialect());
assertEquals("http://apache.org/cxf/systest/ws/addr_feature/", metadata.getMetadataSection().get(0).getIdentifier());
assertEquals("http://www.w3.org/2001/XMLSchema", metadata.getMetadataSection().get(1).getDialect());
GetMetadata body = new GetMetadata();
body.setDialect("http://www.w3.org/2001/XMLSchema");
metadata = exc.getMetadata(body);
assertEquals(1, metadata.getMetadataSection().size());
assertEquals("http://www.w3.org/2001/XMLSchema", metadata.getMetadataSection().get(0).getDialect());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Metadata in project bgpcep by opendaylight.
the class AbstractTopologySessionListener method stateSynchronizationAchieved.
/**
* Indicate that the peer has completed state synchronization.
*
* @param ctx Message context
*/
protected final synchronized void stateSynchronizationAchieved(final MessageContext ctx) {
if (this.synced.getAndSet(true)) {
LOG.debug("State synchronization achieved while synchronizing, not updating state");
return;
}
if (this.triggeredResyncInProcess) {
this.triggeredResyncInProcess = false;
}
updatePccNode(ctx, new PathComputationClientBuilder().setStateSync(PccSyncState.Synchronized).build());
// The node has completed synchronization, cleanup metadata no longer reported back
this.nodeState.cleanupExcept(this.lsps.values());
LOG.debug("Session {} achieved synchronized state", this.session);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Metadata in project netvirt by opendaylight.
the class ElanUtils method buildKnownSmacFlow.
public FlowEntity buildKnownSmacFlow(ElanInstance elanInfo, InterfaceInfo interfaceInfo, long macTimeout, String macAddress) {
int lportTag = interfaceInfo.getInterfaceTag();
// Matching metadata and eth_src fields
List<MatchInfo> mkMatches = new ArrayList<>();
mkMatches.add(new MatchMetadata(ElanHelper.getElanMetadataLabel(elanInfo.getElanTag(), lportTag), ElanHelper.getElanMetadataMask()));
mkMatches.add(new MatchEthernetSource(new MacAddress(macAddress)));
List<InstructionInfo> mkInstructions = new ArrayList<>();
mkInstructions.add(new InstructionGotoTable(NwConstants.ELAN_DMAC_TABLE));
BigInteger dpId = interfaceInfo.getDpId();
long elanTag = getElanTag(elanInfo, interfaceInfo);
return new FlowEntityBuilder().setDpnId(dpId).setTableId(NwConstants.ELAN_SMAC_TABLE).setFlowId(getKnownDynamicmacFlowRef(NwConstants.ELAN_SMAC_TABLE, dpId, lportTag, macAddress, elanTag)).setPriority(20).setFlowName(elanInfo.getDescription()).setIdleTimeOut((int) macTimeout).setHardTimeOut(0).setCookie(ElanConstants.COOKIE_ELAN_KNOWN_SMAC.add(BigInteger.valueOf(elanTag))).setMatchInfoList(mkMatches).setInstructionInfoList(mkInstructions).setStrictFlag(true).setSendFlowRemFlag(macTimeout != 0).build();
}
Aggregations