Add aaa-12 add config code for huawei device and add l2tpv3 yang files

RCA:
SOL:
修改人:maxiaonan
检视人:
This commit is contained in:
maxiaonan 2019-09-26 10:12:33 +08:00
parent 03422647f7
commit 3c956f398e
6 changed files with 936 additions and 0 deletions

View File

@ -0,0 +1,75 @@
/*
* Project: driver-layer-aggregator
*
* File Created at 2019/9/11
*
* Copyright 2016 CMCC Corporation Limited.
* All rights reserved.
*
* This software is the confidential and proprietary information of
* ZYHY Company. ("Confidential Information"). You shall not
* disclose such Confidential Information and shall use it only in
* accordance with the terms of the license.
*/
package com.cmcc.cmhi.huawei.impl;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint;
/**
* @author MaXiaonan
* @Type ChangeNode.class
* @Desc
* @date 2019/9/11 17:40
*/
public class ChangeNode extends ChangeType {
private Node node;
private TerminationPoint tp;
/**
* Getter method for property <tt>node</tt>.
*
* @return property value of node
*/
public Node getNode() {
return node;
}
/**
* Setter method for property <tt>node</tt>.
*
* @param node value to be assigned to property node
*/
public void setNode(Node node) {
this.node = node;
}
/**
* Getter method for property <tt>tp</tt>.
*
* @return property value of tp
*/
public TerminationPoint getTp() {
return tp;
}
/**
* Setter method for property <tt>tp</tt>.
*
* @param tp value to be assigned to property tp
*/
public void setTp(TerminationPoint tp) {
this.tp = tp;
}
}
/**
* Revision history
* -------------------------------------------------------------------------
* <p>
* Date Author Note
* -------------------------------------------------------------------------
* 2019/9/11 MaXiaonan creat
*/

View File

@ -18,6 +18,7 @@ public class HuaweiDriverProvider {
private final DataBroker dataBroker;
private final MountPointService mountService;
private HuaweiNetconfConfig netconfConfig = null;
private HuaweiDriverRegister register = null;
private HuaweiNetconfSpeaker netconfSpeaker = null;
@ -26,6 +27,7 @@ public class HuaweiDriverProvider {
this.mountService = mountService;
this.register = new HuaweiDriverRegister(this.dataBroker);
this.netconfSpeaker = new HuaweiNetconfSpeaker(this.dataBroker, this.mountService);
this.netconfConfig = new HuaweiNetconfConfig(this.dataBroker,this.mountService);
}
/**

View File

@ -0,0 +1,285 @@
/*
* Project: driver-layer-aggregator
*
* File Created at 2019/9/9
*
* Copyright 2016 CMCC Corporation Limited.
* All rights reserved.
*
* This software is the confidential and proprietary information of
* ZYHY Company. ("Confidential Information"). You shall not
* disclose such Confidential Information and shall use it only in
* accordance with the terms of the license.
*/
package com.cmcc.cmhi.huawei.impl;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.*;
import org.opendaylight.controller.md.sal.binding.api.*;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.OptimisticLockFailedException;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.yang.gen.v1.http.www.huawei.com.netconf.vrp.huawei.l2tpv3.rev181123.L2tpv3;
import org.opendaylight.yang.gen.v1.http.www.huawei.com.netconf.vrp.huawei.l2tpv3.rev181123.l2tpv3.GlobalAttribute;
import org.opendaylight.yang.gen.v1.http.www.huawei.com.netconf.vrp.huawei.l2tpv3.rev181123.l2tpv3.GlobalAttributeBuilder;
import org.opendaylight.yang.gen.v1.http.www.huawei.com.netconf.vrp.huawei.l2tpv3.rev181123.l2tpv3.L2tpv3PWInstances;
import org.opendaylight.yang.gen.v1.http.www.huawei.com.netconf.vrp.huawei.l2tpv3.rev181123.l2tpv3.L2tpv3PWInstancesBuilder;
import org.opendaylight.yang.gen.v1.http.www.huawei.com.netconf.vrp.huawei.l2tpv3.rev181123.l2tpv3.l2tpv3pwinstances.L2tpv3PWInstance;
import org.opendaylight.yang.gen.v1.http.www.huawei.com.netconf.vrp.huawei.l2tpv3.rev181123.l2tpv3.l2tpv3pwinstances.L2tpv3PWInstanceBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.network.topology.topology.topology.types.TopologyNetconf;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.Executors;
import static org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType.DELETE;
import static org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType.WRITE;
/**
* @author MaXiaonan
* @Type HuaweiNetconfConfig.class
* @Desc
* @date 2019/9/9 17:34
*/
public class HuaweiNetconfConfig implements DataTreeChangeListener<Node>,
AutoCloseable {
private final DataBroker dataBroker;
private final MountPointService mountService;
private final ListenerRegistration<HuaweiNetconfConfig> configListener;
private Logger LOG = LoggerFactory.getLogger(HuaweiNetconfConfig.class);
private RpcResult<Void> SUCCESS = RpcResultBuilder.<Void>success().build();
private RpcResult<Void> FAILED = RpcResultBuilder.<Void>failed().build();
public static final InstanceIdentifier<Topology> NETCONF_TOPO_IID =
InstanceIdentifier
.create(NetworkTopology.class)
.child(Topology.class,
new TopologyKey(new TopologyId(TopologyNetconf.QNAME.getLocalName())));
public HuaweiNetconfConfig(DataBroker dataBroker, MountPointService mountService){
this.dataBroker = dataBroker;
this.mountService = mountService;
InstanceIdentifier<Node> tpPath = InstanceIdentifier.create(Node.class);
final DataTreeIdentifier<Node> dataTreeIdentifier = new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, tpPath);
configListener = dataBroker.registerDataTreeChangeListener(dataTreeIdentifier, this);
}
@Override
public void close() {
configListener.close();
}
@Override
public void onDataTreeChanged(@Nonnull Collection<DataTreeModification<Node>> changes) {
for (DataTreeModification<Node> change : changes) {
DataObjectModification<Node> rootNode = change.getRootNode();
if(isNodeExist(rootNode)){
if (rootNode.getModificationType() == WRITE) {
Node oldEntry = rootNode.getDataBefore();
Node newEntry = rootNode.getDataAfter();
LOG.info("onDataTreeChanged - Config with path {} was added or replaced: "
+ "old Node: {}, new Node: {}", change.getRootPath().getRootIdentifier(),
oldEntry, newEntry);
ArrayList<ChangeNode> changeTypes = checkWriteType(oldEntry, newEntry);
changeTypes.forEach(this::writeConfigToDevice);
} else if (rootNode.getModificationType() == DELETE) {
LOG.info("onDataTreeChanged - Config with path {} was deleted: old Node: {}",
change.getRootPath().getRootIdentifier(), rootNode.getDataBefore());
}
}
}
}
private void writeConfigToDevice(ChangeNode changeNode) {
//write l2tpv3
//TODO before write ,check the service is enable first
final Optional<MountPoint> hwNodeOptional = mountService.getMountPoint(NETCONF_TOPO_IID
.child(Node.class, changeNode.getNode().getKey()));
Preconditions.checkArgument(hwNodeOptional.isPresent(),
"Unable to locate mountpoint: %s, not mounted yet or not configured",
changeNode.getNode().getKey().getNodeId());
final MountPoint hwNode = hwNodeOptional.get();
InstanceIdentifier<GlobalAttribute> iid =
InstanceIdentifier.create(L2tpv3.class).child(GlobalAttribute.class);
// Get the DataBroker for the mounted node
final DataBroker hwNodeBroker = hwNode.getService(DataBroker.class).get();
boolean enable = checkGlobalEnable(hwNodeBroker,iid,changeNode);
if(!enable){
writeGlobalEnableToDevice(iid,hwNodeBroker);
}
writeL2tpV3Information(changeNode,hwNodeBroker);
mergeTPInformation(changeNode,hwNodeBroker);
}
private void writeL2tpV3Information(ChangeNode changeNode, DataBroker hwNodeBroker) {
InstanceIdentifier<L2tpv3PWInstances> iid =
InstanceIdentifier.create(L2tpv3.class).child(L2tpv3PWInstances.class);
L2tpv3PWInstanceBuilder builder = new L2tpv3PWInstanceBuilder();
L2tpv3PWInstancesBuilder l2tpv3InstancesBuilder = new L2tpv3PWInstancesBuilder();
List<L2tpv3PWInstance> l2tpv3InstanceList = new ArrayList<>();
l2tpv3InstancesBuilder.setL2tpv3PWInstance(l2tpv3InstanceList);
final WriteTransaction writeTransaction = hwNodeBroker.newWriteOnlyTransaction();
writeTransaction.put(LogicalDatastoreType.OPERATIONAL, iid,l2tpv3InstancesBuilder.build());
final CheckedFuture<Void, TransactionCommitFailedException> submit = writeTransaction.submit();
Futures.addCallback(submit, new FutureCallback<Void>() {
@Override
public void onFailure(Throwable throwable) {
if (throwable instanceof OptimisticLockFailedException) {
LOG.warn("Write L2tpv3PW information 捕获 乐观锁异常,本次获取忽略!");
} else {
LOG.error("Write L2tpv3PW information failed." + throwable.getMessage());
}
}
@Override
public void onSuccess(Void avoid) {
LOG.info("Write L2tpv3PW information success.");
}
});
}
private void mergeTPInformation(ChangeNode changeNode, DataBroker hwNodeBroker) {
InstanceIdentifier<Node> NODE_IID = NETCONF_TOPO_IID
.child(Node.class, changeNode.getNode().getKey());
TerminationPoint tp = changeNode.getTp();
InstanceIdentifier<TerminationPoint> tpIID =NODE_IID
.child(TerminationPoint.class);
final WriteTransaction writeTransaction = hwNodeBroker.newWriteOnlyTransaction();
writeTransaction.put(LogicalDatastoreType.OPERATIONAL, tpIID,tp);
final CheckedFuture<Void, TransactionCommitFailedException> submit = writeTransaction.submit();
Futures.addCallback(submit, new FutureCallback<Void>() {
@Override
public void onFailure(Throwable throwable) {
if (throwable instanceof OptimisticLockFailedException) {
LOG.warn("Write config information 捕获 乐观锁异常,本次获取忽略!");
} else {
LOG.error("Write config information failed." + throwable.getMessage());
}
}
@Override
public void onSuccess(Void avoid) {
LOG.info("Write config information success.");
}
});
}
private void writeGlobalEnableToDevice(InstanceIdentifier<GlobalAttribute> iid, DataBroker hwNodeBroker) {
ListeningExecutorService pool = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(5));
GlobalAttributeBuilder builder =new GlobalAttributeBuilder();
final WriteTransaction writeTransaction = hwNodeBroker.newWriteOnlyTransaction();
writeTransaction.put(LogicalDatastoreType.OPERATIONAL,iid,builder.setGlobalEnable(true).build());
ListenableFuture<Void> submit = writeTransaction.submit();
FutureCallback<Void> futureCallback = new FutureCallback<Void>() {
@Override
public void onSuccess(Void result) {
LOG.info("Write enable information success.");
}
@Override
public void onFailure(Throwable throwable) {
if (throwable instanceof OptimisticLockFailedException) {
LOG.warn("Write enable information 捕获 乐观锁异常,本次获取忽略!");
} else {
LOG.error("Write enable information failed." + throwable.getMessage());
}
}
};
Futures.addCallback(submit, futureCallback, pool);
}
private boolean checkGlobalEnable(DataBroker hwNodeBroker, InstanceIdentifier<GlobalAttribute> iid, ChangeNode changeNode) {
Optional<GlobalAttribute> globalInfos;
// Start a new read only transaction that we will use to read data
// from the device
final ReadOnlyTransaction hwNodeReadTx = hwNodeBroker.newReadOnlyTransaction();
LOG.info("开始向华为设备读取GlobalAttribute 信息!");
try {
// Read from a transaction is asynchronous, but a simple
// get/checkedGet makes the call synchronous
globalInfos = hwNodeReadTx.read(LogicalDatastoreType.OPERATIONAL, iid).checkedGet();
} catch (ReadFailedException e) {
throw new IllegalStateException("Unexpected error reading data from " + changeNode, e);
}
boolean enable = false;
if(globalInfos.isPresent()){
enable = globalInfos.get().isGlobalEnable();
}
return enable;
}
private boolean isNodeExist(DataObjectModification<Node> rootNode) {
InstanceIdentifier<Node> nodeIid = NETCONF_TOPO_IID
.child(Node.class, rootNode.getDataAfter().getKey());
return Objects.isNull(mountService.getMountPoint(nodeIid));
}
private ArrayList<ChangeNode> checkWriteType(Node oldEntry, Node newEntry) {
ArrayList<ChangeNode> changeTypes = new ArrayList<>();
List<TerminationPoint> oldTPs;
if (Objects.isNull(oldEntry)) {
oldTPs = new ArrayList<>();
} else {
oldTPs = oldEntry.getTerminationPoint();
}
List<TerminationPoint> newTPs ;
if (Objects.isNull(newEntry)) {
newTPs = new ArrayList<>();
}else {
newTPs = newEntry.getTerminationPoint();
}
while (oldTPs.iterator().hasNext()) {
TerminationPoint devices = oldTPs.iterator().next();
if (newTPs.contains(devices)) {
oldTPs.remove(devices);
newTPs.remove(devices);
}
}
for (TerminationPoint newTp : newTPs) {
ChangeNode changeNode = new ChangeNode();
changeNode.setTp(newTp);
changeNode.setType(ChangeType.Type.ADD);
changeTypes.add(changeNode);
}
for (TerminationPoint tp : oldTPs) {
ChangeNode changeNode = new ChangeNode();
changeNode.setTp(tp);
changeNode.setType(ChangeType.Type.DELETE);
changeTypes.add(changeNode);
}
return changeTypes;
}
}
/**
* Revision history
* -------------------------------------------------------------------------
* <p>
* Date Author Note
* -------------------------------------------------------------------------
* 2019/9/9 MaXiaonan creat
*/

View File

@ -0,0 +1,68 @@
/*
Copyright (C) 2013-2018 Huawei Technologies Co., Ltd. All rights reserved.
*/
submodule huawei-l2tpv3-action {
belongs-to huawei-l2tpv3 {
prefix l2tpv3;
}
import huawei-extension {
prefix ext;
}
include huawei-l2tpv3-type;
organization
"Huawei Technologies Co., Ltd.";
contact
"Huawei Industrial Base
Bantian, Longgang
Shenzhen 518129
People's Republic of China
Website: http://www.huawei.com
Email: support@huawei.com";
description
"Description FOR submodule";
revision 2018-11-23 {
description
"The modifications in the schema file are synchronized to the YANG file.";
reference
"Huawei private.";
}
revision 2018-06-11 {
description
"The modifications in the schema file are synchronized to the YANG file.";
reference
"Huawei private.";
}
revision 2017-12-23 {
description
"The modifications in the schema file are synchronized to the YANG file.";
reference
"Huawei private.";
}
revision 2017-03-23 {
description
"Functions supported by the schema are added to the YANG file.";
reference
"Huawei private.";
}
revision 2013-01-01 {
description
"Init revision";
reference
"Huawei private.";
}
rpc resetStats {
description
"Reset the statistic result.";
ext:node-ref "/l2tpv3/l2tpv3PWInstances/l2tpv3PWInstance";
input {
leaf pwName {
type string {
length "1..19";
}
description
"Name of a Tunnel.";
}
}
}
}

View File

@ -0,0 +1,154 @@
/*
Copyright (C) 2013-2018 Huawei Technologies Co., Ltd. All rights reserved.
*/
submodule huawei-l2tpv3-type {
belongs-to huawei-l2tpv3 {
prefix l2tpv3;
}
organization
"Huawei Technologies Co., Ltd.";
contact
"Huawei Industrial Base
Bantian, Longgang
Shenzhen 518129
People's Republic of China
Website: http://www.huawei.com
Email: support@huawei.com";
description
"Description FOR submodule";
revision 2018-11-23 {
description
"The modifications in the schema file are synchronized to the YANG file.";
reference
"Huawei private.";
}
revision 2018-06-11 {
description
"The modifications in the schema file are synchronized to the YANG file.";
reference
"Huawei private.";
}
revision 2017-12-23 {
description
"The modifications in the schema file are synchronized to the YANG file.";
reference
"Huawei private.";
}
revision 2017-03-23 {
description
"Functions supported by the schema are added to the YANG file.";
reference
"Huawei private.";
}
revision 2013-01-01 {
description
"Init revision";
reference
"Huawei private.";
}
typedef cookieAuthMode {
type enumeration {
enum "authNone" {
description
"Current auth mode is none";
}
enum "authPlain" {
description
"Current auth mode is plain";
}
enum "authCipher" {
description
"Current auth mode is cipher";
}
}
description
"Cookie Auth Mode";
}
typedef l2tpv3PwRoleType {
type enumeration {
enum "primary" {
description
"Primary Tunnel";
}
enum "injected" {
description
"Injected Tunnel";
}
}
description
"PW Role Type";
}
typedef l2tpv3InstanceType {
type enumeration {
enum "normal" {
description
"Normal Mode";
}
enum "localConnect" {
description
"Local Connect mode";
}
}
description
"Instance Type";
}
typedef l2tpv3DiffservMode {
type enumeration {
enum "pipe" {
description
"";
}
enum "uniform" {
description
"";
}
}
description
"Diff Service Mode";
}
typedef l2tpv3State {
type enumeration {
enum "down" {
description
"down";
}
enum "up" {
description
"up";
}
}
description
"L2TPv3 State";
}
typedef cookieLength {
type enumeration {
enum "4" {
description
"4 Bytes";
}
enum "8" {
description
"8 Bytes";
}
}
description
"Cookie Length";
}
typedef L2tpv3ipv6Address {
type string {
length "0..255";
pattern '\s*((([0-9A-Fa-f]{1,4}:){7}(([0-9A-Fa-f]{1,4})|:))|(([0-9A-Fa-f]{1,4}:){6}(:|((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})|(:[0-9A-Fa-f]{1,4})))|(([0-9A-Fa-f]{1,4}:){5}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:){4}(:[0-9A-Fa-f]{1,4}){0,1}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:){3}(:[0-9A-Fa-f]{1,4}){0,2}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:){2}(:[0-9A-Fa-f]{1,4}){0,3}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:)(:[0-9A-Fa-f]{1,4}){0,4}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(:(:[0-9A-Fa-f]{1,4}){0,5}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})))(%.+)?\s*';
}
description
"An IPV6 address in standard notation";
}
typedef L2tpv3OnlyIpv6 {
type string {
length "0..255";
pattern '(([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}))|(:((:[0-9A-Fa-f]{1,4}){1,6}|:))|([0-9A-Fa-f]{1,4}:((:[0-9A-Fa-f]{1,4}){1,5}|:))|(([0-9A-Fa-f]{1,4}:){2}((:[0-9A-Fa-f]{1,4}){1,4}|:))|(([0-9A-Fa-f]{1,4}:){3}((:[0-9A-Fa-f]{1,4}){1,3}|:))|(([0-9A-Fa-f]{1,4}:){4}((:[0-9A-Fa-f]{1,4}){1,2}|:))|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4})?)|(([0-9A-Fa-f]{1,4}:){6}:)';
}
description
"An IPV6 address in standard notation without IPV4 address";
}
}

View File

@ -0,0 +1,352 @@
/*
Copyright (C) 2013-2018 Huawei Technologies Co., Ltd. All rights reserved.
*/
module huawei-l2tpv3 {
namespace "http://www.huawei.com/netconf/vrp/huawei-l2tpv3";
prefix l2tpv3;
import huawei-ifm {
prefix ifm;
}
import huawei-pub-type {
prefix pub-type;
}
import ietf-inet-types {
prefix inet;
}
import huawei-extension {
prefix ext;
}
include huawei-l2tpv3-action;
include huawei-l2tpv3-type;
organization
"Huawei Technologies Co., Ltd.";
contact
"Huawei Industrial Base
Bantian, Longgang
Shenzhen 518129
People's Republic of China
Website: http://www.huawei.com
Email: support@huawei.com";
description
"L2TPV3";
revision 2018-11-23 {
description
"The modifications in the schema file are synchronized to the YANG file.";
reference
"Huawei private.";
}
revision 2018-06-11 {
description
"The modifications in the schema file are synchronized to the YANG file.";
reference
"Huawei private.";
}
revision 2017-12-23 {
description
"The modifications in the schema file are synchronized to the YANG file.";
reference
"Huawei private.";
}
revision 2017-03-23 {
description
"Functions supported by the schema are added to the YANG file.";
reference
"Huawei private.";
}
revision 2013-01-01 {
description
"Init revision";
reference
"Huawei private.";
}
container l2tpv3 {
description
"L2TPV3";
container globalAttribute {
description
"The global attribute of L2TPV3.";
ext:entry-from "system";
leaf globalEnable {
type boolean;
default "false";
description
"To enable L2TPV3. By default, L2TPV3 is disabled.";
}
}
container l2tpv3PWInstances {
description
"All L2TPV3 Tunnels. ";
list l2tpv3PWInstance {
when "../../globalAttribute/globalEnable='true'";
key "pwName";
description
"All L2TPV3 Tunnels. ";
leaf pwName {
type string {
length "1..19";
}
description
"Name of a Tunnel.";
}
leaf sourceIfName {
type leafref {
path "/ifm:ifm/ifm:interfaces/ifm:interface/ifm:ifName";
}
description
"Config The Source Interface Name Of Tunnel ";
ext:allowDelete "true";
}
leaf sourceIP {
when "../sourceIfName";
type inet:ip-address-no-zone;
description
"Source IP Address Of Tunnel,must be the same with the ip of loopback interface. ";
}
leaf destIP {
type inet:ip-address-no-zone;
description
"Config The Destination IP Address of Tunnel";
ext:allowDelete "true";
}
leaf localSessionId {
type uint32 {
range "1..4294967295";
}
default "4294967295";
description
"Config The Local Session ID";
ext:allowDelete "true";
}
leaf remoteSessionId {
type uint32 {
range "1..4294967295";
}
default "4294967295";
description
"Config The Remote Session ID";
ext:allowDelete "true";
}
leaf localCookieAutoMode {
type cookieAuthMode;
must "(../localCookieAutoMode='authNone' and not(../localSecondaryCookieAutoMode='authCipher' or ../localSecondaryCookieAutoMode='authPlain')) or not(../localCookieAutoMode='authNone')";
default "authNone";
description
"Config the mode of the authentication of the local cookie field";
ext:allowDelete "true";
}
leaf localSecondaryCookieAutoMode {
type cookieAuthMode;
must "((../localSecondaryCookieAutoMode='authCipher' or ../localSecondaryCookieAutoMode='authPlain') and not(../localCookieAutoMode='authNone')) or not(../localSecondaryCookieAutoMode='authCipher' or ../localSecondaryCookieAutoMode='authPlain')";
default "authNone";
description
"Config the mode of the authentication of the local secondary cookie field";
ext:allowDelete "true";
}
leaf remoteCookieAutoMode {
type cookieAuthMode;
default "authNone";
description
"Config the mode of the authentication of the remote cookie field";
ext:allowDelete "true";
}
leaf localCookieLength {
when "../localCookieAutoMode='authPlain'";
type cookieLength;
mandatory true;
description
"Config the length of the local cookie field";
}
leaf localSecondaryCookieLength {
when "../localSecondaryCookieAutoMode='authPlain'";
type cookieLength;
mandatory true;
description
"Config the length of the local secondary cookie field";
}
leaf remoteCookieLength {
when "../remoteCookieAutoMode='authPlain'";
type cookieLength;
mandatory true;
description
"Config the length of the remote cookie field";
}
leaf localHighCookie {
when "../localCookieLength='8'";
type pub-type:hexBinary;
mandatory true;
description
"Config the value of the upper 4 bytes of the local cookie field";
}
leaf localSecondaryHighCookie {
when "../localSecondaryCookieLength='8'";
type pub-type:hexBinary;
mandatory true;
description
"Config the value of the upper 4 bytes of the local secondary cookie field";
}
leaf localLowCookie {
when "../localCookieAutoMode='authPlain'";
type pub-type:hexBinary;
mandatory true;
description
"Config the value of the lower 4 bytes of the local cookie field";
}
leaf localSecondaryLowCookie {
when "../localSecondaryCookieAutoMode='authPlain'";
type pub-type:hexBinary;
mandatory true;
description
"Config the value of the lower 4 bytes of the local secondary cookie field";
}
leaf remoteHighCookie {
when "../remoteCookieLength='8'";
type pub-type:hexBinary;
mandatory true;
description
"Config the value of the upper 4 bytes of the remote cookie field";
}
leaf remoteLowCookie {
when "../remoteCookieAutoMode='authPlain'";
type pub-type:hexBinary;
mandatory true;
description
"Config the value of the lower 4 bytes of the remote cookie field";
}
leaf localCookieCipher {
when "../localCookieAutoMode='authCipher'";
type pub-type:password {
length "1..108";
}
mandatory true;
description
"Config the value of the local cookie field";
}
leaf localSecondaryCookieCipher {
when "../localSecondaryCookieAutoMode='authCipher'";
type pub-type:password {
length "1..108";
}
mandatory true;
description
"Config the value of the local secondary cookie field";
}
leaf remoteCookieCipher {
when "../remoteCookieAutoMode='authCipher'";
type pub-type:password {
length "1..108";
}
description
"Config the value of the remote cookie field";
}
leaf sendPacket {
type uint64;
config false;
description
"Send Packets";
}
leaf sendByte {
type uint64;
config false;
description
"Send Bytes";
}
leaf rcvPacket {
type uint64;
config false;
description
"Receive Packets";
}
leaf receiveByte {
type uint64;
config false;
description
"Receive Bytes";
}
leaf recvDropPacket {
type uint64;
config false;
description
"Total Number Of dropped packets";
}
leaf cookieMisDropPacket {
type uint64;
config false;
description
"Receive Cookie Mismatch Packets Number";
}
leaf state {
type l2tpv3State;
config false;
description
"Tunnel State";
}
}
}
container l2tpv3Instances {
description
"All L2TPV3 instances. ";
list l2tpv3Instance {
when "/l2tpv3/globalAttribute/globalEnable='true'";
key "instanceName instanceType";
description
"All L2TPV3 instances. ";
leaf instanceName {
type string {
length "1..31";
}
description
"A L2TPV3 instance.";
}
leaf instanceType {
type l2tpv3InstanceType;
description
"Type of a L2TPV3 instance. ";
}
leaf ifName {
type leafref {
path "/ifm:ifm/ifm:interfaces/ifm:interface/ifm:ifName";
}
mandatory true;
description
"Name of a sub-interface.";
}
leaf outIfName {
when "not(../instanceType='normal')";
type leafref {
path "/ifm:ifm/ifm:interfaces/ifm:interface/ifm:ifName";
}
description
"Name of a sub-interface.";
ext:allowDelete "true";
}
container l2tpv3PWs {
must "not(../instanceType='normal') or (../instanceType='normal' and count(l2tpv3PW)<=2) and ((../instanceType='normal' and count(l2tpv3PW)>=0))";
description
"L2TPV3 Tunnel information.";
list l2tpv3PW {
when "not(../../instanceType='localConnect')";
key "pwName";
max-elements 2;
description
"L2TPV3 Tunnel information.";
leaf pwName {
type leafref {
path "../../../../../l2tpv3PWInstances/l2tpv3PWInstance/pwName";
}
description
"Name of a Tunnel.";
}
leaf pwRole {
type l2tpv3PwRoleType;
default "primary";
description
"Whether the tunnel is a primary or injected tunnel.";
}
}
}
}
}
}
}