Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/transformer/models_list
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ openconfig-interfaces-annot.yang
openconfig-interfaces.yang
openconfig-mclag-annot.yang
openconfig-mclag.yang
openconfig-p4rt.yang
openconfig-sampling-sflow-annot.yang
openconfig-sampling-sflow.yang
openconfig-system-annot.yang
Expand Down
34 changes: 34 additions & 0 deletions models/yang/annotations/openconfig-interfaces-annot.yang
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ module openconfig-interfaces-annot {
import openconfig-vlan {prefix oc-vlan; }
import openconfig-if-ip {prefix oc-ip; }
import openconfig-if-aggregate { prefix oc-lag; }
import openconfig-p4rt { prefix "p4rt-if"; }
import openconfig-platform-port { prefix "oc-plat-port"; }
import openconfig-platform-transceiver { prefix "oc-plat-xcvr"; }

deviation /oc-intf:interfaces/oc-intf:interface {
deviate add {
Expand Down Expand Up @@ -277,4 +280,35 @@ module openconfig-interfaces-annot {
}
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:config/p4rt-if:id {
deviate add {
sonic-ext:field-transformer "pins_if_id_xfmr";
}
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:state/p4rt-if:id {
deviate add {
sonic-ext:field-transformer "pins_if_id_xfmr";
sonic-ext:table-name "P4RT_PORT_ID_TABLE";
}
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:state/oc-plat-port:hardware-port {
deviate add {
sonic-ext:field-transformer "intf_hardware_port_xfmr";
sonic-ext:field-name "index";
}
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:state/oc-plat-xcvr:transceiver {
deviate add {
sonic-ext:field-transformer "intf_transceiver_xfmr";
}
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:state/oc-plat-xcvr:physical-channel {
deviate add {
sonic-ext:field-transformer "intf_physical_channel_xfmr";
}
}
}
4 changes: 0 additions & 4 deletions models/yang/extensions/openconfig-interfaces-deviation.yang
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ module openconfig-interfaces-deviation {
deviate not-supported;
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:state/oc-intf:counters/oc-intf:in-fcs-errors {
deviate not-supported;
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:state/oc-intf:counters/oc-intf:carrier-transitions {
deviate not-supported;
}
Expand Down
69 changes: 69 additions & 0 deletions models/yang/openconfig-p4rt.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
module openconfig-p4rt {
yang-version "1";

prefix "oc-p4rt";

namespace "http://openconfig.net/yang/p4rt";

import openconfig-extensions { prefix oc-ext; }
import openconfig-interfaces { prefix oc-if; }

organization
"OpenConfig Working Group";

contact
"www.openconfig.net";

description
"This module defines a set of extensions that provide P4Runtime (P4RT)
specific extensions to the OpenConfig data models. Specifically, these
parameters for configuration and state provide extensions that control
the P4RT service, or allow it to be used alongside other OpenConfig
data models.

The P4RT protocol specification is linked from https://p4.org/specs/
under the P4Runtime heading.";

oc-ext:openconfig-version "0.1.0";

revision 2021-04-06 {
description
"Initial revision.";
reference "0.1.0";
}

grouping p4rt-interface-config {
description
"Interface-specific configuration that is applicable to devices that
are running the P4RT service.";

leaf id {
type uint32;
description
"The numeric identifier used by the controller to address the interface.
This ID is assigned by an external-to-the-device entity (e.g., an SDN
management system) to establish an externally deterministic numeric
reference for the interface. The programming entity must ensure that
the ID is unique within the required context.

Note that this identifier is used only when a numeric reference to the
interface is required, it does not replace the unique name assigned to
the interface.";
}
}

augment "/oc-if:interfaces/oc-if:interface/oc-if:config" {
description
"Add interface-specific intended configuration for P4RT.";

uses p4rt-interface-config;
}

augment "/oc-if:interfaces/oc-if:interface/oc-if:state" {
description
"Add interface-specific applied configuration for P4RT.";

uses p4rt-interface-config;
}
}

6 changes: 5 additions & 1 deletion translib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ TRANSL_DB_ALL_SRCS = $(filter ./db/%, $(SRCS) $(TESTS))
TRANSLIB_TEST_DIR = $(BUILD_DIR)/tests/translib
TRANSLIB_TEST_BIN = $(TRANSLIB_TEST_DIR)/translib.test
TRANSL_DB_TEST_BIN = $(TRANSLIB_TEST_DIR)/db.test
PLATFORM_TEST_BIN = $(TRANSLIB_TEST_DIR)/platform.test

TRANSFORMER_TEST_BIN = $(TRANSLIB_TEST_DIR)/transformer.test
TRANSFORMER_ALL_SRCS = $(filter ./transformer/%, $(SRCS) $(TESTS))
Expand All @@ -43,7 +44,7 @@ XFMR_TEST_MODELS = $(notdir $(wildcard transformer/test/*.yang))

DEFAULT_TARGETS = $(YGOT_BINDS) $(XFMR_MODELS_LIST) $(FORMAT_CHECK)
ifeq ($(NO_TEST_BINS),)
DEFAULT_TARGETS += $(TRANSLIB_TEST_BIN) $(TRANSL_DB_TEST_BIN) $(TRANSFORMER_TEST_APP_BIN)
DEFAULT_TARGETS += $(TRANSLIB_TEST_BIN) $(TRANSL_DB_TEST_BIN) $(TRANSFORMER_TEST_APP_BIN) $(PLATFORM_TEST_BIN)
ifdef INCLUDE_TEST_MODELS
DEFAULT_TARGETS += $(TRANSFORMER_TEST_BIN)
endif
Expand All @@ -58,6 +59,9 @@ all: $(DEFAULT_TARGETS)
$(TRANSLIB_TEST_BIN): $(TRANSLIB_MAIN_SRCS) $(TRANSLIB_TEST_SRCS) $(YGOT_BINDS)
$(GO) test -mod=vendor -tags test -cover -coverpkg=../translib,../translib/tlerr -c ../translib -o $@

$(PLATFORM_TEST_BIN): $(TRANSLIB_MAIN_SRCS)
$(GO) test -mod=vendor -tags test -cover -coverpkg=../translib/platform -c ../translib/platform -o $@

$(TRANSL_DB_TEST_BIN) : $(TRANSL_DB_ALL_SRCS)
$(GO) test -mod=vendor -cover -c ../translib/db -o $@

Expand Down
Loading