Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testcases merge #111

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
9 changes: 8 additions & 1 deletion confdgnmi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ SRC_DIR=src
TEST_DIR=tests
PCG_DIR=$(SRC_DIR)

OC_YANG = $(shell grep -L ^submodule oc/*.yang)
OC_FXS = $(OC_YANG:oc/%.yang=%.fxs)

all: gnmi_proto \
iana-if-type.fxs ietf-interfaces.fxs route-status.fxs \
iana-if-type.fxs ietf-interfaces.fxs route-status.fxs $(OC_FXS) \
$(CDB_DIR) ssh-keydir init_interfaces.xml
@echo "Build complete"

Expand All @@ -47,6 +49,10 @@ all: gnmi_proto \
init_interfaces.xml:
./datagen.py 10


$(OC_FXS) : %.fxs : oc/%.yang
confdc -c -o $@ --yangpath oc/ $^

gnmi_proto:
python -m grpc_tools.protoc -I$(PCG_DIR)/proto --python_out=$(PCG_DIR) --grpc_python_out=$(PCG_DIR) $(PCG_DIR)/proto/gnmi.proto $(PCG_DIR)/proto/gnmi_ext.proto

Expand All @@ -69,6 +75,7 @@ start: stop
$(CONFD) -c confd.conf $(CONFD_FLAGS)
confd_load -m -l ./init_interfaces.xml
confd_load -m -O -l ./init_interfaces_state.xml
confd_load -mol ./oc-interfaces.xml ./oc-components.xml

######################################################################
stop:
Expand Down
4 changes: 2 additions & 2 deletions confdgnmi/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ConfD gNMI Adapter Demo

This project represents ConfD gNMI Adapter demo.

See `docs/ConfD_gNMI_adapter.adoc` for the User and Developer documentation.
See [docs/ConfD_gNMI_adapter.adoc](docs/ConfD_gNMI_adapter.adoc) for the User and Developer documentation.
3 changes: 1 addition & 2 deletions confdgnmi/datagen.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@


def gen_intf(name):
interface = """<interface xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0"
ns0:operation="create">
interface = """<interface>
<name>{}</name>
<type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">
gigabitEthernet
Expand Down
98 changes: 98 additions & 0 deletions confdgnmi/oc-components.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<config xmlns="http://tail-f.com/ns/config/1.0">
<components xmlns="http://openconfig.net/yang/platform">
<component>
<name>box0</name>
<config>
<name>box0</name>
</config>
<state>
<name>box0</name>
</state>
</component>
<component>
<name>confd</name>
<config>
<name>confd</name>
</config>
<state>
<name>confd</name>
</state>
</component>
<component>
<name>cpu0</name>
<config>
<name>cpu0</name>
</config>
<state>
<name>cpu0</name>
</state>
<subcomponents>
<subcomponent>
<name>confd</name>
<config>
<name>confd</name>
</config>
<state>
<name>confd</name>
</state>
</subcomponent>
<subcomponent>
<name>fan0</name>
<config>
<name>fan0</name>
</config>
<state>
<name>fan0</name>
</state>
</subcomponent>
</subcomponents>
</component>
<component>
<name>fan0</name>
<config>
<name>fan0</name>
</config>
<state>
<name>fan0</name>
</state>
</component>
<component>
<name>fan1</name>
<config>
<name>fan1</name>
</config>
<state>
<name>fan1</name>
</state>
</component>
<component>
<name>lc0</name>
<config>
<name>lc0</name>
</config>
<state>
<name>lc0</name>
</state>
<subcomponents>
<subcomponent>
<name>cpu0</name>
<config>
<name>cpu0</name>
</config>
<state>
<name>cpu0</name>
</state>
</subcomponent>
<subcomponent>
<name>fan1</name>
<config>
<name>fan1</name>
</config>
<state>
<name>fan1</name>
</state>
</subcomponent>
</subcomponents>
</component>
</components>
</config>
80 changes: 80 additions & 0 deletions confdgnmi/oc-interfaces.xml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would not it be better to generated data like the other interfaces?

Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<config xmlns="http://tail-f.com/ns/config/1.0">
<interfaces xmlns="http://openconfig.net/yang/interfaces">
<interface>
<name>GigabitEthernet1/1/1</name>
<config>
<name>GigabitEthernet1/1/1</name>
<type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:ethernetCsmacd</type>
<enabled>true</enabled>
</config>
<state>
<name>GigabitEthernet1/1/1</name>
</state>
<subinterfaces>
<subinterface>
<index>12</index>
<config>
<index>12</index>
</config>
<state>
<index>12</index>
</state>
</subinterface>
</subinterfaces>
</interface>
<interface>
<name>Port-channel1</name>
<config>
<name>Port-channel1</name>
<type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:propVirtual</type>
<enabled>true</enabled>
</config>
<state>
<name>Port-channel1</name>
</state>
<subinterfaces>
<subinterface>
<index>1</index>
<config>
<index>1</index>
</config>
<state>
<index>1</index>
</state>
</subinterface>
</subinterfaces>
</interface>
<interface>
<name>gig0</name>
<config>
<name>gig0</name>
<type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:ethernetCsmacd</type>
</config>
<state>
<name>gig0</name>
</state>
<ethernet xmlns="http://openconfig.net/yang/interfaces/ethernet">
<config>
<mac-address>00:11:22:33:44:55</mac-address>
<auto-negotiate>false</auto-negotiate>
<port-speed>SPEED_10GB</port-speed>
</config>
<switched-vlan xmlns="http://openconfig.net/yang/vlan">
<config>
<interface-mode>TRUNK</interface-mode>
</config>
</switched-vlan>
</ethernet>
</interface>
<interface>
<name>gig2</name>
<config>
<name>gig2</name>
<type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:gigabitEthernet</type>
</config>
<state>
<name>gig2</name>
</state>
</interface>
</interfaces>
</config>
150 changes: 150 additions & 0 deletions confdgnmi/oc/openconfig-alarm-types.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
module openconfig-alarm-types {

yang-version "1";

// namespace
namespace "http://openconfig.net/yang/alarms/types";

prefix "oc-alarm-types";

// import some basic types
import openconfig-extensions { prefix oc-ext; }

// meta
organization "OpenConfig working group";

contact
"OpenConfig working group
www.openconfig.net";

description
"This module defines operational state data related to alarms
that the device is reporting.

This model reuses some data items defined in the draft IETF
YANG Alarm Module:
https://tools.ietf.org/html/draft-vallin-netmod-alarm-module-02

Portions of this code were derived from the draft IETF YANG Alarm
Module. Please reproduce this note if possible.

IETF code is subject to the following copyright and license:
Copyright (c) IETF Trust and the persons identified as authors of
the code.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, is permitted pursuant to, and subject to the license
terms contained in, the Simplified BSD License set forth in
Section 4.c of the IETF Trust's Legal Provisions Relating
to IETF Documents (http://trustee.ietf.org/license-info).";

oc-ext:openconfig-version "0.2.1";

revision "2018-11-21" {
description
"Add OpenConfig module metadata extensions.";
reference "0.2.1";
}

revision "2018-01-16" {
description
"Moved alarm identities into separate types module";
reference "0.2.0";
}

// OpenConfig specific extensions for module metadata.
oc-ext:regexp-posix;
oc-ext:catalog-organization "openconfig";
oc-ext:origin "openconfig";

// identity statements
identity OPENCONFIG_ALARM_TYPE_ID {
description
"Base identity for alarm type ID profiles";
}

identity AIS {
base OPENCONFIG_ALARM_TYPE_ID;
description
"Defines an alarm indication signal type of alarm";
}

identity EQPT {
base OPENCONFIG_ALARM_TYPE_ID;
description
"Defines an equipment related type of alarm that is specific
to the physical hardware";
}

identity LOS {
base OPENCONFIG_ALARM_TYPE_ID;
description
"Defines a loss of signal type of alarm";
}

identity OTS {
base OPENCONFIG_ALARM_TYPE_ID;
description
"Defines a optical transport signal type of alarm";
}

identity OPENCONFIG_ALARM_SEVERITY {
description
"Base identity for alarm severity profiles. Derived
identities are based on contents of the draft
IETF YANG Alarm Module";
reference
"IETF YANG Alarm Module: Draft - typedef severity
https://tools.ietf.org/html/draft-vallin-netmod-alarm-module-02";

}

identity UNKNOWN {
base OPENCONFIG_ALARM_SEVERITY;
description
"Indicates that the severity level could not be determined.
This level SHOULD be avoided.";
}

identity MINOR {
base OPENCONFIG_ALARM_SEVERITY;
description
"Indicates the existence of a non-service affecting fault
condition and that corrective action should be taken in
order to prevent a more serious (for example, service
affecting) fault. Such a severity can be reported, for
example, when the detected alarm condition is not currently
degrading the capacity of the resource";
}

identity WARNING {
base OPENCONFIG_ALARM_SEVERITY;
description
"Indicates the detection of a potential or impending service
affecting fault, before any significant effects have been felt.
Action should be taken to further diagnose (if necessary) and
correct the problem in order to prevent it from becoming a more
serious service affecting fault.";
}

identity MAJOR {
base OPENCONFIG_ALARM_SEVERITY;
description
"Indicates that a service affecting condition has developed
and an urgent corrective action is required. Such a severity
can be reported, for example, when there is a severe
degradation in the capability of the resource and its full
capability must be restored.";
}

identity CRITICAL {
base OPENCONFIG_ALARM_SEVERITY;
description
"Indicates that a service affecting condition has occurred
and an immediate corrective action is required. Such a
severity can be reported, for example, when a resource becomes
totally out of service and its capability must be restored.";
}

}
Loading