use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId in project netvirt by opendaylight.
the class ElanStatisticsImpl method getElanInterfaceStatistics.
@Override
public Future<RpcResult<GetElanInterfaceStatisticsOutput>> getElanInterfaceStatistics(GetElanInterfaceStatisticsInput input) {
String interfaceName = input.getInterfaceName();
LOG.debug("getElanInterfaceStatistics is called for elan interface {}", interfaceName);
RpcResultBuilder<GetElanInterfaceStatisticsOutput> rpcResultBuilder = null;
if (interfaceName == null) {
rpcResultBuilder = RpcResultBuilder.failed();
return getFutureWithAppErrorMessage(rpcResultBuilder, "Interface name is not provided");
}
Optional<ElanInterface> elanInterface = elanInterfaceCache.get(interfaceName);
if (!elanInterface.isPresent()) {
rpcResultBuilder = RpcResultBuilder.failed();
return getFutureWithAppErrorMessage(rpcResultBuilder, String.format("Interface %s is not a ELAN interface", interfaceName));
}
String elanInstanceName = elanInterface.get().getElanInstanceName();
InterfaceInfo interfaceInfo = interfaceManager.getInterfaceInfo(interfaceName);
// FIXME [ELANBE] Get this API Later
short tableId = 0;
// }
if (!interfaceInfo.isOperational()) {
LOG.debug("interface {} is down and returning with no statistics", interfaceName);
rpcResultBuilder = RpcResultBuilder.success();
return Futures.immediateFuture(rpcResultBuilder.withResult(new GetElanInterfaceStatisticsOutputBuilder().setStatResult(new StatResultBuilder().setStatResultCode(ResultCode.NotFound).setByteRxCount(0L).setByteTxCount(0L).setPacketRxCount(0L).setPacketTxCount(0L).build()).build()).build());
}
rpcResultBuilder = RpcResultBuilder.success();
return Futures.immediateFuture(rpcResultBuilder.withResult(queryforElanInterfaceStatistics(tableId, elanInstanceName, interfaceInfo)).build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId in project netvirt by opendaylight.
the class DhcpServiceUtils method bindDhcpService.
public static void bindDhcpService(String interfaceName, short tableId, WriteTransaction tx) {
int instructionKey = 0;
List<Instruction> instructions = new ArrayList<>();
instructions.add(MDSALUtil.buildAndGetGotoTableInstruction(tableId, ++instructionKey));
short serviceIndex = ServiceIndex.getIndex(NwConstants.DHCP_SERVICE_NAME, NwConstants.DHCP_SERVICE_INDEX);
BoundServices serviceInfo = getBoundServices(String.format("%s.%s", "dhcp", interfaceName), serviceIndex, DhcpMConstants.DEFAULT_FLOW_PRIORITY, DhcpMConstants.COOKIE_VM_INGRESS_TABLE, instructions);
tx.put(LogicalDatastoreType.CONFIGURATION, buildServiceId(interfaceName, serviceIndex), serviceInfo, WriteTransaction.CREATE_MISSING_PARENTS);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId in project netvirt by opendaylight.
the class CountersServiceUtils method createFlowOnTable.
public static Flow createFlowOnTable(Match match, int priority, short tableId, BigInteger cookie, Integer timeout) {
FlowBuilder fb = new FlowBuilder();
if (match != null) {
fb.setMatch(match);
}
FlowId flowId = createFlowId();
fb.setTableId(tableId);
fb.setIdleTimeout(0).setHardTimeout(0);
fb.setId(flowId);
if (timeout != null) {
fb.setHardTimeout(timeout);
}
if (cookie != null) {
fb.setCookie(new FlowCookie(cookie));
}
fb.setPriority(priority);
Flow flow = fb.build();
return flow;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId in project netvirt by opendaylight.
the class VPNServiceChainHandlerTest method testProgramVpnToScfWithVpnIfacesAlreadyBound.
@Test
public void testProgramVpnToScfWithVpnIfacesAlreadyBound() throws Exception {
// ///////////////////
// Basic stubbing //
// ///////////////////
String ifaceName = "eth0";
stubGetRouteDistinguisher(VPN_NAME, RD);
stubGetVpnInstance(RD, "1.2.3.4", ifaceName);
VrfEntry vrfEntry = FibHelper.getVrfEntryBuilder("11.12.13.14", 2000L, DC_GW_IP, RouteOrigin.STATIC, null).build();
stubGetVrfEntries(RD, Collections.singletonList(vrfEntry));
stubReadVpnToDpnList(RD, DPN_ID, Collections.singletonList(ifaceName));
stubScfIsBoundOnIface(SCF_TAG, ifaceName);
// ///////
// SUT //
// ///////
short tableId = 10;
vpnsch.programVpnToScfPipeline(VPN_NAME, tableId, SCF_TAG, LPORT_TAG, NwConstants.ADD_FLOW);
// //////////
// Verify //
// //////////
ArgumentCaptor<FlowEntity> argumentCaptor = ArgumentCaptor.forClass(FlowEntity.class);
verify(mdsalMgr, times(2)).installFlow(argumentCaptor.capture());
List<FlowEntity> installedFlowsCaptured = argumentCaptor.getAllValues();
assert installedFlowsCaptured.size() == 2;
RoutePaths routePath = vrfEntry.getRoutePaths().get(0);
FlowEntity expectedLFibFlowEntity = VpnServiceChainUtils.buildLFibVpnPseudoPortFlow(DPN_ID, routePath.getLabel(), routePath.getNexthopAddress(), LPORT_TAG);
assert new FlowEntityMatcher(expectedLFibFlowEntity).matches(installedFlowsCaptured.get(0));
FlowEntity expectedLPortDispatcher = VpnServiceChainUtils.buildLportFlowDispForVpnToScf(DPN_ID, LPORT_TAG, SCF_TAG, tableId);
assert new FlowEntityMatcher(expectedLPortDispatcher).matches(installedFlowsCaptured.get(1));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId in project netvirt by opendaylight.
the class ElanDpnInterfacesListener method remove.
@Override
protected void remove(InstanceIdentifier<DpnInterfaces> identifier, final DpnInterfaces dpnInterfaces) {
final String elanName = getElanName(identifier);
BigInteger removeDpnId = dpnInterfaces.getDpId();
LOG.debug("ELAN interfaces {} removed from on DPN {} for ELAN {}", dpnInterfaces.getInterfaces(), removeDpnId, elanName);
Optional<ElanServiceChainState> elanServiceChainState = ElanServiceChainUtils.getElanServiceChainState(broker, elanName);
if (elanServiceChainState.isPresent()) {
List<ElanToPseudoPortData> elanToPseudoPortDataList = elanServiceChainState.get().getElanToPseudoPortData();
for (ElanToPseudoPortData elanToPseudoPortData : elanToPseudoPortDataList) {
Long scfTag = elanToPseudoPortData.getScfTag();
Long elanLportTag = elanToPseudoPortData.getElanLportTag();
if (scfTag != null && elanLportTag != null) {
handleUpdate(removeDpnId, elanName, (short) 0, /* tableId, ignored in removals */
elanLportTag.intValue(), /*21 bit*/
0, /* scfTag, ignored in removals */
NwConstants.DEL_FLOW);
} else {
LOG.debug("One of scfTag or lPortTag is null for ELAN={}: scfTag={} lportTag={}", elanName, scfTag, elanLportTag);
}
}
}
}
Aggregations