本文整理了Java中org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface
类的一些代码示例,展示了Interface
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Interface
类的具体详情如下:
包路径:org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface
类名称:Interface
[英]The list of configured interfaces on the device. The operational state of an interface is available in the /interfaces-state/interface list. If the configuration of a system-controlled interface cannot be used by the system (e.g., the interface hardware present does not match the interface type), then the configuration is not applied to the system-controlled interface shown in /interfaces-state/interface list. If the configuration of a user-controlled interface cannot be used by the system, the configured interface is not instantiated in the /interfaces-state/interface list.
This class represents the following YANG schema fragment defined in module ietf-interfaces
list interface {
key "name"
leaf name {
type string;
}
leaf description {
type string;
}
leaf type {
type identityref;
}
leaf enabled {
type enabled;
}
leaf link-up-down-trap-enable {
type enumeration;
}
}
The schema path to identify an instance is ietf-interfaces/interfaces/interface
To create instances of this class use org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceBuilder.
[中]设备上已配置接口的列表。接口的操作状态在/interfaces state/interface列表中可用。如果系统无法使用系统控制接口的配置(例如,存在的接口硬件与接口类型不匹配),则该配置不会应用于/interfaces state/interface list中显示的系统控制接口。如果系统无法使用用户控制接口的配置,则配置的接口不会在/interfaces state/interface列表中实例化。
此类表示模块ietf接口中定义的以下模式片段
list interface {
key "name"
leaf name {
type string;
}
leaf description {
type string;
}
leaf type {
type identityref;
}
leaf enabled {
type enabled;
}
leaf link-up-down-trap-enable {
type enumeration;
}
}
标识实例的模式路径是ietf接口/接口/接口
要创建此类的实例,请使用org。露天采光。杨。第1代。瓮。ietf。params。xml。纳什。杨。ietf。接口。rev140508。接口。接口生成器。
代码示例来源:origin: org.opendaylight.mdsal.model/ietf-interfaces
if (!Objects.equals(_description, other.getDescription())) {
return false;
if (!Objects.equals(_key, other.getKey())) {
return false;
if (!Objects.equals(_linkUpDownTrapEnable, other.getLinkUpDownTrapEnable())) {
return false;
if (!Objects.equals(_name, other.getName())) {
return false;
if (!Objects.equals(_type, other.getType())) {
return false;
if (!Objects.equals(_enabled, other.isEnabled())) {
return false;
if (!e.getValue().equals(other.getAugmentation(e.getKey()))) {
return false;
代码示例来源:origin: org.opendaylight.mdsal.binding.model.ietf/rfc7223
if (!Objects.equals(_description, other.getDescription())) {
return false;
if (!Objects.equals(_linkUpDownTrapEnable, other.getLinkUpDownTrapEnable())) {
return false;
if (!Objects.equals(_name, other.getName())) {
return false;
if (!Objects.equals(_type, other.getType())) {
return false;
if (!Objects.equals(_enabled, other.isEnabled())) {
return false;
if (!e.getValue().equals(other.augmentation(e.getKey()))) {
return false;
代码示例来源:origin: io.fd.honeycomb.vpp/vpp-translate-utils
/**
* Check the type of interface equals expected type
*
* @throws IllegalInterfaceTypeException if type of interface is null or not expected
*/
static void checkInterfaceType(@Nonnull final Interface ifc,
@Nonnull final Class<? extends InterfaceType> expectedType) {
if (ifc.getType() == null || !expectedType.equals(ifc.getType())) {
throw new IllegalInterfaceTypeException(String.format(
"Unexpected interface type: %s for interface: %s. Expected interface is: %s", ifc.getType(),
ifc.getName(), expectedType));
}
}
代码示例来源:origin: org.opendaylight.mdsal.binding.model.ietf/rfc7223
public InterfaceBuilder(Interface base) {
this.key = base.key();
this._name = base.getName();
this._description = base.getDescription();
this._linkUpDownTrapEnable = base.getLinkUpDownTrapEnable();
this._type = base.getType();
this._enabled = base.isEnabled();
if (base instanceof InterfaceImpl) {
InterfaceImpl impl = (InterfaceImpl) base;
if (!impl.augmentation.isEmpty()) {
this.augmentation = new HashMap<>(impl.augmentation);
}
} else if (base instanceof AugmentationHolder) {
@SuppressWarnings("unchecked")
Map<Class<? extends Augmentation<Interface>>, Augmentation<Interface>> aug =((AugmentationHolder<Interface>) base).augmentations();
if (!aug.isEmpty()) {
this.augmentation = new HashMap<>(aug);
}
}
}
代码示例来源:origin: org.opendaylight.netvirt/aclservice-impl
public static List<AllowedAddressPairs> getPortAllowedAddresses(Interface port) {
if (port == null) {
LOG.error("Port is Null");
return null;
}
InterfaceAcl aclInPort = port.getAugmentation(InterfaceAcl.class);
if (aclInPort == null) {
LOG.error("getSecurityGroupInPortList: no security group associated to Interface port: {}", port.getName());
return null;
}
return aclInPort.getAllowedAddressPairs();
}
代码示例来源:origin: org.opendaylight.vpnservice/nexthopmgr-impl
@Override
protected void add(InstanceIdentifier<Interface> identifier, Interface intrf) {
LOG.trace("Adding Interface : key: " + identifier + ", value=" + intrf );
if (intrf.getType().equals(L3tunnel.class)) {
IfL3tunnel intfData = intrf.getAugmentation(IfL3tunnel.class);
IpAddress gatewayIp = intfData.getGatewayIp();
IpAddress remoteIp = (gatewayIp == null) ? intfData.getRemoteIp() : gatewayIp;
NodeConnectorId ofPort = intrf.getAugmentation(BaseIds.class).getOfPortId();
nexthopManager.createRemoteNextHop(intrf.getName(), ofPort.toString(), remoteIp.getIpv4Address().getValue());
}
}
代码示例来源:origin: org.opendaylight.genius/itm-impl
public void addInterface(Interface iface) {
this.interfaces.put(iface.getName(), iface);
}
代码示例来源:origin: org.opendaylight.genius/interfacemanager-shell
public static void showVlanOutput(InterfaceInfo ifaceInfo, Interface iface) {
StringBuilder sb = new StringBuilder();
Formatter fmt = new Formatter(sb);
IfL2vlan l2vlan = iface.getAugmentation(IfL2vlan.class);
int vlanId = l2vlan != null ? l2vlan.getVlanId() != null ? l2vlan.getVlanId().getValue() : 0 : 0;
System.out.println(fmt.format(VLAN_OUTPUT_FORMAT_LINE1,
iface.getName()));
sb.setLength(0);
System.out.println(fmt.format(VLAN_OUTPUT_FORMAT,
"", (ifaceInfo == null) ? UNSET : ifaceInfo.getDpId(),
(ifaceInfo == null) ? UNSET : ifaceInfo.getPortName(), vlanId));
sb.setLength(0);
System.out.println(fmt.format(VLAN_OUTPUT_FORMAT,
(ifaceInfo == null) ? UNSET : ifaceInfo.getInterfaceTag(),
(ifaceInfo == null) ? UNSET : ifaceInfo.getPortNo(),
(ifaceInfo == null) ? UNSET : ifaceInfo.getAdminState(),
(ifaceInfo == null) ? UNSET : ifaceInfo.getOpState()));
sb.setLength(0);
System.out.println(fmt.format(VLAN_OUTPUT_FORMAT + "\n",
iface.getDescription(), "", "", ""));
sb.setLength(0);
fmt.close();
}
代码示例来源:origin: org.opendaylight.netvirt/elanmanager-impl
public static boolean isExternal(
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
.ietf.interfaces.rev140508.interfaces.Interface iface) {
if (iface == null) {
return false;
}
IfExternal ifExternal = iface.getAugmentation(IfExternal.class);
return ifExternal != null && Boolean.TRUE.equals(ifExternal.isExternal());
}
代码示例来源:origin: org.opendaylight.vpnservice/alivenessmonitor-impl
private List<ActionInfo> getInterfaceActions(String interfaceName, long portNum) throws InterruptedException, ExecutionException {
Class<? extends InterfaceType> intfType;
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface interfaceInfo =
getInterfaceFromConfigDS(interfaceName);
if(interfaceInfo != null) {
intfType = interfaceInfo.getType();
} else {
LOG.error("Could not retrieve port type for interface {} to construct actions", interfaceName);
return Collections.emptyList();
}
List<ActionInfo> actionInfos = new ArrayList<ActionInfo>();
// Set the LLDP service Id which is 0
if(Tunnel.class.equals(intfType)) {
actionInfos.add(new ActionInfo(ActionType.set_field_tunnel_id, new BigInteger[] {
BigInteger.valueOf(0)}));
}
actionInfos.add(new ActionInfo(ActionType.output, new String[] { Long.toString(portNum) }));
return actionInfos;
}
代码示例来源:origin: io.fd.hc2vpp.v3po/v3po2vpp
private void setInterfaceAttributes(final InstanceIdentifier<Interface> id, final Interface swIf,
final String swIfName, final WriteContext writeContext)
throws WriteFailedException {
setInterfaceFlags(id, swIfName, interfaceContext.getIndex(swIfName, writeContext.getMappingContext()),
swIf.isEnabled()
? (byte) 1
: (byte) 0);
}
代码示例来源:origin: io.fd.hc2vpp.v3po/v3po2vpp
/**
* Returns true if interface does not have v4/v6 addresses configured
*/
private boolean isAddressNotPresentForInterface(@Nonnull final InstanceIdentifier<Routing> id,
@Nonnull final WriteContext ctx,
boolean checkBefore) {
final Optional<Interface> interfaceData = checkBefore
? ctx.readBefore(RWUtils.cutId(id, Interface.class))
: ctx.readAfter(RWUtils.cutId(id, Interface.class));
if (interfaceData.isPresent()) {
final java.util.Optional<Interface1> augData = java.util.Optional.of(interfaceData.get())
.map(iface -> iface.augmentation(Interface1.class));
final boolean v4NotPresent =
augData.map(Interface1::getIpv4).map(Ipv4::getAddress).map(List::isEmpty).orElse(true);
final boolean v6NotPresent =
augData.map(Interface1::getIpv6).map(Ipv6::getAddress).map(List::isEmpty).orElse(true);
return v4NotPresent && v6NotPresent;
}
return true;
}
}
代码示例来源:origin: org.opendaylight.mdsal.model/ietf-interfaces
public InterfaceBuilder(Interface base) {
if (base.getKey() == null) {
this._key = new InterfaceKey(
base.getName()
);
this._name = base.getName();
} else {
this._key = base.getKey();
this._name = _key.getName();
}
this._description = base.getDescription();
this._linkUpDownTrapEnable = base.getLinkUpDownTrapEnable();
this._type = base.getType();
this._enabled = base.isEnabled();
if (base instanceof InterfaceImpl) {
InterfaceImpl impl = (InterfaceImpl) base;
if (!impl.augmentation.isEmpty()) {
this.augmentation = new HashMap<>(impl.augmentation);
}
} else if (base instanceof AugmentationHolder) {
@SuppressWarnings("unchecked")
AugmentationHolder<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface>) base;
if (!casted.augmentations().isEmpty()) {
this.augmentation = new HashMap<>(casted.augmentations());
}
}
}
代码示例来源:origin: org.opendaylight.netvirt/aclservice-impl
@Override
protected void add(InstanceIdentifier<Interface> key, Interface port) {
InterfaceAcl aclInPort = port.getAugmentation(InterfaceAcl.class);
if (aclInPort != null && aclInPort.isPortSecurityEnabled()) {
addAclInterfaceToCache(port.getName(), aclInPort);
}
}
代码示例来源:origin: org.opendaylight.vpnservice/nexthopmgr-impl
@Override
protected void remove(InstanceIdentifier<Interface> identifier,
Interface intrf) {
LOG.trace("Removing interface : key: " + identifier + ", value=" + intrf );
if (intrf.getType().equals(L3tunnel.class)) {
BigInteger dpnId = interfaceManager.getDpnForInterface(intrf);
IfL3tunnel intfData = intrf.getAugmentation(IfL3tunnel.class);
IpAddress gatewayIp = intfData.getGatewayIp();
IpAddress remoteIp = (gatewayIp == null) ? intfData.getRemoteIp() : gatewayIp;
nexthopManager.removeRemoteNextHop(dpnId, intrf.getName(), remoteIp.getIpv4Address().getValue());
}
}
代码示例来源:origin: io.fd.honeycomb.v3po/v3po2vpp
private void updateInterface(final InstanceIdentifier<Interface> id,
final Interface dataBefore,
final Interface dataAfter, final WriteContext writeContext)
throws VppBaseCallException, WriteTimeoutException {
LOG.debug("Updating interface:{} to: {}", id, dataAfter);
setInterfaceAttributes(id, dataAfter, dataAfter.getName(), writeContext);
}
代码示例来源:origin: org.opendaylight.genius/interfacemanager-shell
public static void showVxlanOutput(Interface iface, InterfaceInfo interfaceInfo) {
StringBuilder sb = new StringBuilder();
Formatter fmt = new Formatter(sb);
System.out.println(fmt.format(VXLAN_OUTPUT_FORMAT_LINE1,
iface.getName(),
iface.getDescription() == null ? UNSET : iface.getDescription()));
sb.setLength(0);
IfTunnel ifTunnel = iface.getAugmentation(IfTunnel.class);
System.out.println(fmt.format(VXLAN_OUTPUT_FORMAT,
ifTunnel.getTunnelSource().getIpv4Address().getValue(),
ifTunnel.getTunnelDestination().getIpv4Address().getValue(),
ifTunnel.getTunnelGateway() == null ? UNSET : ifTunnel.getTunnelGateway().getIpv4Address().getValue(),
(interfaceInfo == null) ? InterfaceInfo.InterfaceAdminState.DISABLED : interfaceInfo.getAdminState()));
sb.setLength(0);
ParentRefs parentRefs = iface.getAugmentation(ParentRefs.class);
System.out.println(fmt.format(VXLAN_OUTPUT_FORMAT + "\n",
(interfaceInfo == null) ? InterfaceOpState.DOWN : interfaceInfo.getOpState(),
String.format("%s/%s", parentRefs.getDatapathNodeIdentifier(),
iface.getName()),
(interfaceInfo == null) ? UNSET : interfaceInfo.getInterfaceTag(), ""));
fmt.close();
}
}
代码示例来源:origin: org.opendaylight.groupbasedpolicy/vpp-renderer
private static @Nullable String resolveBridgeDomain(@Nonnull Interface iface) {
VppInterfaceAugmentation vppInterfaceAugmentation = iface.getAugmentation(VppInterfaceAugmentation.class);
L2 existingL2 = vppInterfaceAugmentation.getL2();
if (existingL2 != null) {
Interconnection interconnection = existingL2.getInterconnection();
if (interconnection instanceof BridgeBased) {
return ((BridgeBased) interconnection).getBridgeDomain();
}
}
return null;
}
代码示例来源:origin: org.opendaylight.netvirt/vpnmanager-impl
configInterface = InterfaceUtils.getInterface(dataBroker, interfaceName);
if (configInterface != null) {
if (!configInterface.getType().equals(Tunnel.class)) {
LOG.debug("Config Interface Name {}", configInterface.getName());
final VpnInterface vpnInterface = VpnUtil.getConfiguredVpnInterface(dataBroker, interfaceName);
if (vpnInterface != null) {
代码示例来源:origin: org.opendaylight.vpnservice/vpnmanager-impl
@Override
protected void update(InstanceIdentifier<Interface> identifier,
Interface original, Interface update) {
LOG.trace("Operation Interface update event - Old: {}, New: {}", original, update);
String interfaceName = update.getName();
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface
intf = InterfaceUtils.getInterface(broker, interfaceName);
if (intf != null && intf.getType().equals(Tunnel.class)) {
/*
// FIXME: Blocked until tunnel event[vxlan/gre] support is available
BigInteger dpnId = InterfaceUtils.getDpIdFromInterface(update);
if(update.getOperStatus().equals(Interface.OperStatus.Up)) {
//advertise all prefixes in all vpns for this dpn to bgp
// vpnInterfaceManager.updatePrefixesForDPN(dpnId, VpnInterfaceManager.UpdateRouteAction.ADVERTISE_ROUTE);
} else if(update.getOperStatus().equals(Interface.OperStatus.Down)) {
//withdraw all prefixes in all vpns for this dpn from bgp
// vpnInterfaceManager.updatePrefixesForDPN(dpnId, VpnInterfaceManager.UpdateRouteAction.WITHDRAW_ROUTE);
}*/
}
}
内容来源于网络,如有侵权,请联系作者删除!