diff --git a/ControlPlatform/driver-layer/.gitignore b/ControlPlatform/driver-layer/.gitignore new file mode 100644 index 000000000..6fb8a301e --- /dev/null +++ b/ControlPlatform/driver-layer/.gitignore @@ -0,0 +1,21 @@ +*.class +**/target +bin/ +dist +**/logs +*~ +target +target-ide +.classpath +.project +.settings +.idea +xtend-gen +yang-gen-config +yang-gen-sal +classes +.DS_STORE +.metadata +*.ipr +*.iml +*.iws diff --git a/ControlPlatform/driver-layer/adaptation-layer/pom.xml b/ControlPlatform/driver-layer/adaptation-layer/pom.xml new file mode 100644 index 000000000..b124185e2 --- /dev/null +++ b/ControlPlatform/driver-layer/adaptation-layer/pom.xml @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + + + org.opendaylight.mdsal + binding-parent + 0.12.4 + + + + com.cmcc.cmhi + adaptation-layer + 0.1.0 + + ODL :: com.cmcc.cmhi :: ${project.artifactId} + bundle + + + + org.opendaylight.mdsal.model + ietf-inet-types-2013-07-15 + + + diff --git a/ControlPlatform/driver-layer/adaptation-layer/src/main/yang/driver-register.yang b/ControlPlatform/driver-layer/adaptation-layer/src/main/yang/driver-register.yang new file mode 100644 index 000000000..6a7943c26 --- /dev/null +++ b/ControlPlatform/driver-layer/adaptation-layer/src/main/yang/driver-register.yang @@ -0,0 +1,132 @@ +// Contents of "driver-register" +module driver-register { + namespace "urn:opendaylight:driver-register"; + prefix "driver-register"; + + import ietf-inet-types { prefix "inet"; revision-date 2013-07-15; } + + organization "ZYHY cmhi Company."; + + contact + "dongxiancun "; + + revision 2019-07-29 { + description "驱动注册信息"; + } + + identity category-type { + description + "Base for all category(网元种类) supported by the 驱动适配层. New category + not listed here may be added in the future."; + } + + identity router { + base category-type; + description "普通路由器"; + } + + identity swich { + base category-type; + description "普通交换机"; + } + + identity of13-swich { + base category-type; + description "openflow1.3的交换机"; + } + + identity l3-swich { + base category-type; + description "三层交换机"; + } + + identity firewall { + base category-type; + description "防火墙"; + } + + identity vpn-gateway { + base category-type; + description "VPN网关"; + } + + identity bras { + base category-type; + description "固网BRAS"; + } + + typedef driver-id { + type inet:uri; + description "An identifier for car entry."; + } + + typedef drived-revision { + type string { + pattern "(19|20)[0-9][0-9]-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])"; + } + description "定义yang module的revision-date格式"; + } + + container driver-register { + description + "Top-level container for all drivers' info"; + list driver-entry { + description "A list of drivers."; + key id; + leaf id { + type driver-id; + description "identifier of the driver."; + } + + leaf enable { + type boolean; + default true; + description "是否让该驱动生效,可以让该功能置位,达到驱动禁用、启用的目的"; + } + + leaf manufacturer { + type string; + description "驱动的厂商信息."; + config false; + mandatory true; + } + + leaf driver-version { + type string; + config false; + mandatory true; + description "驱动的软件版本."; + } + + list categories { + leaf category { + type identityref { + base category-type; + } + default 'router'; + config false; + } + config false; + description "描述性信息,仅供展示:该驱动对应设备的网元类型、范畴,可以同时对应多种范畴。"; + } + + list drived-mudule { + key "drived-namespace drived-revision"; + leaf drived-namespace { + type string; + config false; + mandatory true; + description "该驱动所支持的,驱动适配层定义的yang module的namespace。"; + } + leaf drived-revision { + type drived-revision; + config false; + mandatory true; + description "该驱动所支持的,驱动适配层定义的yang module的revision-date。"; + } + config false; + description "该驱动所支持的,驱动适配层定义的yang module."; + } + } + } +} diff --git a/ControlPlatform/driver-layer/deploy-site.xml b/ControlPlatform/driver-layer/deploy-site.xml new file mode 100644 index 000000000..32c57c79f --- /dev/null +++ b/ControlPlatform/driver-layer/deploy-site.xml @@ -0,0 +1,50 @@ + + + + + 4.0.0 + + com.cmcc.cmhi + deploy-site + 0.1.0 + pom + + + latest + dav:https://nexus.opendaylight.org/content/sites/site/${project.groupId}/${stream}/ + + + + + + org.apache.maven.wagon + wagon-webdav-jackrabbit + 2.9 + + + + + + org.apache.maven.plugins + maven-site-plugin + 3.4 + + ${project.build.directory}/staged-site + + + + + + + + opendaylight-site + ${nexus.site.url} + + + diff --git a/ControlPlatform/driver-layer/drivers/huawei/pom.xml b/ControlPlatform/driver-layer/drivers/huawei/pom.xml new file mode 100644 index 000000000..2fbd6672b --- /dev/null +++ b/ControlPlatform/driver-layer/drivers/huawei/pom.xml @@ -0,0 +1,67 @@ + + + + + + 4.0.0 + + + org.opendaylight.mdsal + binding-parent + 0.12.4 + + + + com.cmcc.cmhi + huawei-driver + 0.1.0 + + ODL :: com.cmcc.cmhi :: ${project.artifactId} + bundle + + + + + org.opendaylight.controller + mdsal-artifacts + 1.7.4 + pom + import + + + + + + + ${project.groupId} + adaptation-layer + ${project.version} + + + + org.opendaylight.controller + sal-binding-api + + + + + junit + junit + test + + + + org.mockito + mockito-core + test + + + diff --git a/ControlPlatform/driver-layer/drivers/huawei/src/main/java/com/cmcc/cmhi/huawei/impl/HuaweiDriverProvider.java b/ControlPlatform/driver-layer/drivers/huawei/src/main/java/com/cmcc/cmhi/huawei/impl/HuaweiDriverProvider.java new file mode 100644 index 000000000..ca7250a11 --- /dev/null +++ b/ControlPlatform/driver-layer/drivers/huawei/src/main/java/com/cmcc/cmhi/huawei/impl/HuaweiDriverProvider.java @@ -0,0 +1,37 @@ +/* + * Copyright © 2019 CMCC Corporation and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package com.cmcc.cmhi.huawei.impl; + +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class HuaweiDriverProvider { + + private static final Logger LOG = LoggerFactory.getLogger(HuaweiDriverProvider.class); + + private final DataBroker dataBroker; + + public HuaweiDriverProvider(final DataBroker dataBroker) { + this.dataBroker = dataBroker; + } + + /** + * Method called when the blueprint container is created. + */ + public void init() { + LOG.info("HuaweiDriverProvider Session Initiated"); + } + + /** + * Method called when the blueprint container is destroyed. + */ + public void close() { + LOG.info("HuaweiDriverProvider Closed"); + } +} \ No newline at end of file diff --git a/ControlPlatform/driver-layer/drivers/huawei/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/ControlPlatform/driver-layer/drivers/huawei/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml new file mode 100644 index 000000000..66dc04a06 --- /dev/null +++ b/ControlPlatform/driver-layer/drivers/huawei/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + diff --git a/ControlPlatform/driver-layer/drivers/pom.xml b/ControlPlatform/driver-layer/drivers/pom.xml new file mode 100644 index 000000000..9d3b2fb63 --- /dev/null +++ b/ControlPlatform/driver-layer/drivers/pom.xml @@ -0,0 +1,29 @@ + + + + + 4.0.0 + + + org.opendaylight.odlparent + odlparent-lite + 3.1.4 + + + + com.cmcc.cmhi + drivers-aggregator + 0.1.0 + pom + + + huawei + + diff --git a/ControlPlatform/driver-layer/features/features-driver-all/pom.xml b/ControlPlatform/driver-layer/features/features-driver-all/pom.xml new file mode 100644 index 000000000..5665a42f0 --- /dev/null +++ b/ControlPlatform/driver-layer/features/features-driver-all/pom.xml @@ -0,0 +1,38 @@ + + + + + 4.0.0 + + + org.opendaylight.odlparent + feature-repo-parent + 3.1.4 + + + + com.cmcc.cmhi + features-driver-all + 0.1.0 + feature + + + + + + ${project.groupId} + feature-huawei-driver + ${project.version} + xml + features + + + + diff --git a/ControlPlatform/driver-layer/features/huawei-driver/pom.xml b/ControlPlatform/driver-layer/features/huawei-driver/pom.xml new file mode 100644 index 000000000..7e4b91f96 --- /dev/null +++ b/ControlPlatform/driver-layer/features/huawei-driver/pom.xml @@ -0,0 +1,161 @@ + + + + + 4.0.0 + + + org.opendaylight.odlparent + single-feature-parent + 3.1.4 + + + + com.cmcc.cmhi + feature-huawei-driver + 0.1.0 + feature + + CMCC :: CMHI :: HuaweiDriver + + + 1.7.4 + 2.4.4 + 0.12.4 + 1.4.4 + 1.7.4 + 2.0.6.5 + 0.7.4 + 0.7.4 + etc/opendaylight/karaf + + + + + + org.opendaylight.netconf + netconf-artifacts + ${netconf.version} + pom + import + + + org.opendaylight.netconf + restconf-artifacts + ${restconf.version} + pom + import + + + + + + + org.opendaylight.netconf + sal-rest-docgen + ${restconf.version} + + + org.opendaylight.yangtools + features-yangtools + features + ${yangtools.version} + xml + + + + org.opendaylight.controller + features-mdsal + features + ${controller.mdsal.version} + xml + runtime + + + org.opendaylight.netconf + features-restconf + features + ${restconf.version} + xml + + + + + org.opendaylight.netconf + features-netconf-connector + features + ${netconf.version} + xml + + + + org.opendaylight.netconf + features-netconf + features + ${netconf.version} + xml + + + + + + org.opendaylight.controller + config-manager-facade-xml + 0.8.4 + + + + + + + com.cmcc.cmhi + huawei-driver + ${project.version} + + + diff --git a/ControlPlatform/driver-layer/features/pom.xml b/ControlPlatform/driver-layer/features/pom.xml new file mode 100644 index 000000000..1faf4e44d --- /dev/null +++ b/ControlPlatform/driver-layer/features/pom.xml @@ -0,0 +1,30 @@ + + + + + 4.0.0 + + + org.opendaylight.odlparent + odlparent-lite + 3.1.4 + + + + com.cmcc.cmhi + driver-layer-features-aggregator + 0.1.0 + pom + + + huawei-driver + features-driver-all + + diff --git a/ControlPlatform/driver-layer/it/pom.xml b/ControlPlatform/driver-layer/it/pom.xml new file mode 100644 index 000000000..adbb1f09d --- /dev/null +++ b/ControlPlatform/driver-layer/it/pom.xml @@ -0,0 +1,46 @@ + + + + + 4.0.0 + + + org.opendaylight.controller + mdsal-it-parent + 1.7.4 + + + + com.cmcc.cmhi + driver-layer-it + 0.1.0 + + ODL :: com.cmcc.cmhi :: ${project.artifactId} + bundle + + + false + com.cmcc.cmhi + driver-layer-karaf + 0.1.0 + zip + + + + + ${project.groupId} + features-driver-all + ${project.version} + features + xml + + + diff --git a/ControlPlatform/driver-layer/it/src/test/java/com/cmcc/cmhi/it/DriverLayerIT.java b/ControlPlatform/driver-layer/it/src/test/java/com/cmcc/cmhi/it/DriverLayerIT.java new file mode 100644 index 000000000..d403ce843 --- /dev/null +++ b/ControlPlatform/driver-layer/it/src/test/java/com/cmcc/cmhi/it/DriverLayerIT.java @@ -0,0 +1,60 @@ +/* + * Copyright © 2019 CMCC Corporation and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package com.cmcc.cmhi.it; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.opendaylight.controller.mdsal.it.base.AbstractMdsalTestBase; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.junit.PaxExam; +import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel; +import org.ops4j.pax.exam.options.MavenUrlReference; +import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; +import org.ops4j.pax.exam.spi.reactors.PerClass; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static org.ops4j.pax.exam.CoreOptions.composite; +import static org.ops4j.pax.exam.CoreOptions.maven; +import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut; + +@RunWith(PaxExam.class) +@ExamReactorStrategy(PerClass.class) +public class DriverLayerIT extends AbstractMdsalTestBase { + private static final Logger LOG = LoggerFactory.getLogger(DriverLayerIT.class); + + @Override + public MavenUrlReference getFeatureRepo() { + return maven() + .groupId("com.cmcc.cmhi") + .artifactId("features-driver-all") + .classifier("features") + .type("xml") + .versionAsInProject(); + } + + @Override + public String getFeatureName() { + return "features-driver-all"; + } + + @Override + public Option getLoggingOption() { + Option option = editConfigurationFilePut(ORG_OPS4J_PAX_LOGGING_CFG, + logConfiguration(DriverLayerIT.class), + LogLevel.INFO.name()); + option = composite(option, super.getLoggingOption()); + return option; + } + + @Test + public void testDriverLayerFeatureLoad() { + Assert.assertTrue(true); + } +} diff --git a/ControlPlatform/driver-layer/karaf/pom.xml b/ControlPlatform/driver-layer/karaf/pom.xml new file mode 100644 index 000000000..fa9f6ad0e --- /dev/null +++ b/ControlPlatform/driver-layer/karaf/pom.xml @@ -0,0 +1,140 @@ + + + + + 4.0.0 + + + org.opendaylight.odlparent + karaf4-parent + 3.1.4 + + + + com.cmcc.cmhi + driver-layer-karaf + 0.1.0 + + ODL :: com.cmcc.cmhi :: ${project.artifactId} + + + + 0.8.4 + + + + + + org.opendaylight.integration + all-artifacts + ${integration.version} + import + pom + + + + + + + + + + + org.opendaylight.integration + features-index + features + xml + runtime + + + org.opendaylight.odlparent + opendaylight-karaf4-empty + + + org.opendaylight.controller + opendaylight-karaf-empty + + + org.opendaylight.odlparent + opendaylight-karaf-empty + + + + + + org.opendaylight.integration + features-test + features + xml + test + + + org.opendaylight.odlparent + opendaylight-karaf4-empty + + + org.opendaylight.controller + opendaylight-karaf-empty + + + org.opendaylight.odlparent + opendaylight-karaf-empty + + + + + + org.opendaylight.aaa + aaa-cli-jar + + test + + + + + ${project.groupId} + features-driver-all + features + ${project.version} + xml + runtime + + + + + + + + org.apache.maven.plugins + maven-install-plugin + + true + + + + org.apache.maven.plugins + maven-deploy-plugin + + true + + + + + diff --git a/ControlPlatform/driver-layer/parent/pom.xml b/ControlPlatform/driver-layer/parent/pom.xml new file mode 100644 index 000000000..e973e8fd1 --- /dev/null +++ b/ControlPlatform/driver-layer/parent/pom.xml @@ -0,0 +1,181 @@ + + + + + + 4.0.0 + + + org.opendaylight.mdsal + binding-parent + 0.12.4 + + + + com.cmcc.cmhi + driver-layer-parent + 0.1.0 + + ODL :: com.cmcc.cmhi :: ${project.artifactId} + pom + + + + + + + org.opendaylight.controller + mdsal-artifacts + 1.7.4 + import + pom + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven.compile.plugin.version} + + ${java.version.source} + ${java.version.target} + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + org.codehaus.mojo + properties-maven-plugin + [0.0,) + + set-system-properties + + + + + + + + + org.jacoco + jacoco-maven-plugin + [0.0,) + + prepare-agent + pre-test + post-test + + + + + + + + + org.ops4j.pax.exam + maven-paxexam-plugin + [1.2.4,) + + generate-depends-file + + + + + false + + + + + + org.opendaylight.yangtools + yang-maven-plugin + [0.5,) + + generate-sources + + + + + + + + + org.codehaus.groovy.maven + gmaven-plugin + 1.0 + + execute + + + + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + ${enforcer.version} + + enforce + + + + + + + + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-checkstyle-plugin + + checkstyle.violationSeverity=error + + + + org.codehaus.mojo + findbugs-maven-plugin + + true + + + + + diff --git a/ControlPlatform/driver-layer/pom.xml b/ControlPlatform/driver-layer/pom.xml new file mode 100644 index 000000000..b04295597 --- /dev/null +++ b/ControlPlatform/driver-layer/pom.xml @@ -0,0 +1,34 @@ + + + + 4.0.0 + + + org.opendaylight.odlparent + odlparent-lite + 3.1.4 + + + + com.cmcc.cmhi + driver-layer-aggregator + 0.1.0 + driver-layer + pom + + + parent + adaptation-layer + drivers + features + karaf + it + + +