Skip to content

Commit

Permalink
refactor(opinetcommon): port config api for basic operation
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Sanders <marksanders194@gmail.com>
  • Loading branch information
sandersms authored and glimchb committed May 8, 2024
1 parent bb755a5 commit 3559fa1
Show file tree
Hide file tree
Showing 16 changed files with 4,469 additions and 641 deletions.
24 changes: 24 additions & 0 deletions network/opinetcommon/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
# OPI Network Common APIs

The common network capabilities need to build on the general capabilities that exist across various use cases for network operations and configuration. This includes (but is not limited to):

- Physical ports
- Logical ports
- Layer 2 interfaces, switches, bridges
- Layer 3 routing operations

The objective of the network common API is to define the characteristics that are common for the general network operations and capture them in this common API. These characteristics are the building blocks that can be used across use cases and allow the basic setup of the physical and logical ports, VLANs, LAG interfaces, switches, etc.

## Demos

## Clients

## Reference implementations

## Basic Network Tenants

### Port/Interface

## Documentation for reference to other specifications and implementations

- Openconfig <https://openconfig.net/>
- <https://docs.kernel.org/networking/netlink_spec/rt_link.html>
217 changes: 217 additions & 0 deletions network/opinetcommon/networkethernet.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2024 Dell Inc, or its subsidiaries.
//
// Derived from the OpenConfig interfaces model github.com/openconfig/public/release/models/interfaces
//
// (-- api-linter: core::0141::forbidden-types=disabled
// aip.dev/not-precedent: counters, mtu, index must be uint and not int. --)
syntax = "proto3";

package opi_api.network.opinetcommon.v1alpha1;

option java_package = "opi_api.network.opinetcommon.v1alpha1";
option java_multiple_files = true;
option java_outer_classname = "NetworkEthernetProto";

option go_package = "github.com/opiproject/opi-api/network/opinetcommon/v1alpha1/gen/go";

import "networkvlan.proto";

import "google/api/field_behavior.proto";

// Ethernet Configuration
message EthernetConfig {
// MAC address to assign to the Ethernet Interface if not assigned
string mac_address = 1 [(google.api.field_behavior) = OPTIONAL];
// Set to TRUE to request autonegotiate the transmission parameters
// with the peer interface
bool auto_negotiate = 2 [(google.api.field_behavior) = OPTIONAL];
// Used when full autonegotiation is not desired by setting to TRUE
// and setting auto_negotiate to FALSE. It is ignored when auto-negotiate
// is set to TRUE.
bool standalone_link_training = 3 [(google.api.field_behavior) = OPTIONAL];
// Optionally sets the duplex mode that is advertised to the peer interface
EthDuplexMode duplex_mode = 4 [(google.api.field_behavior) = OPTIONAL];
// Optionally sets the port speed that is advertised to the peer interface
EthPortSpeed port_speed = 5 [(google.api.field_behavior) = OPTIONAL];
// Override for the negotiated flow control on the interface
bool enable_flow_control = 6 [(google.api.field_behavior) = OPTIONAL];
// FEC applied to the physical channel of the interface
EthFecMode fec_mode = 7 [(google.api.field_behavior) = OPTIONAL];
}

// Ethernet receive frame distribution counters
message EthernetInDistribution {
// Receive counter for 64 byte frames
uint64 rx_frames_octets64 = 1;
// Receive counter for 65 to 127 byte frames
uint64 rx_frames_octets65_to127 = 2;
// Receive counter for 128 to 255 byte frames
uint64 rx_frames_octets128_to255 = 3;
// receive counter for 256 to 511 byte frames
uint64 rx_frames_octets256_to511 = 4;
// receive counter for 512 to 1023 byte frames
uint64 rx_frames_octets512_to1023 = 5;
// receive counter for 1024 to 1518 byte frames
uint64 rx_frames_octets1024_to1518 = 6;
}

// Ethernet Interface Counters
message EthernetCounters {
// received mac control frame counter
uint64 rx_mac_control_frames = 1;
// received mac pause frame counter
uint64 rx_mac_pause_frames = 2;
// frames received that were oversized on the interface
// (larger then 1518 octets)
uint64 rx_oversize_frames = 3;
// frames received that were undersized on the interface
// (smaller then 64 octets)
uint64 rx_undersize_frames = 4;
// Number of jabber frames received on the interface.
// Jabber frames are typically defined as oversize frames which also
// have a bad CRC
uint64 rx_jabber_frames = 5;
// The total number of frames received that were less than 64 octets
// in length (excluding framing bits but including FCS octets)
// and had either a bad Frame Check Sequence (FCS) with an integral
// number of octets (FCS Error) or a bad FCS with a non-integral number
// of octets (Alignment Error)
uint64 rx_fragment_frames = 6;
// Number of 802.1q tagged frames received on the interface
uint64 rx_ieee8021q_frames = 7;
// The total number of frames received that had FCS errors
uint64 rx_crc_errors = 8;
// The number of received errored blocks
uint64 rx_block_errors = 9;
// The number of received errored frames due to a carrier issue
uint64 rx_carrier_errors = 10;
// The number of received errored frames due to interrupted transmission
// issue
uint64 rx_interrupted_tx = 11;
// The number of received errored frames due to late collision issue
uint64 rx_late_collision = 12;
// The number of received errored frames due to MAC errors received
uint64 rx_mac_errors_rx = 13;
// The number of received errored frames due to single collision issue
uint64 rx_single_collision = 14;
// The number of received errored frames due to symbol error
uint64 rx_symbol_error = 15;
// The total number frames received that are well-formed but dropped due
// to exceeding the maximum frame size on the interface
uint64 rx_maxsize_exceeded = 16;
// MAC layer control frames sent on the interface
uint64 out_mac_control_frames = 17;
// MAC layer PAUSE frames sent on the interface
uint64 out_mac_pause_frames = 18;
// Number of 802.1q tagged frames sent on the interface
uint64 out_ieee8021q_frames = 19;
// The number of sent errored frames due to MAC errors transmitted
uint64 out_mac_errors_tx = 20;
// Receive Frame Distribution counters
EthernetInDistribution eth_rx_distribution = 21;
}

// Ethernet interface state settings
message EthernetState {
// MAC address to assign to the Ethernet Interface if not assigned or
// being overridden.
string mac_address = 1;
// Set to TRUE to request autonegotiate the transmission parameters
// with the peer interface
bool auto_negotiate = 2;
// Used when full autonegotiation is not desired by setting to TRUE
// and setting auto_negotiate to FALSE. It is ignored when auto-negotiate
// is set to TRUE.
bool standalone_link_training = 3;
// The duplex mode that is negotiated or set interface
EthDuplexMode duplex_mode = 4;
// The port speed that is negotiated or set for the interface
EthPortSpeed port_speed = 5;
// Override for the negotiated flow control on the interface
bool enable_flow_control = 6;
// FEC applied to the physical channel of the interface
EthFecMode fec_mode = 7;
// Hardware MAC address defined for the interface
string hw_mac_address = 8;
// Negotiated Duplex mode for the interface
EthDuplexMode negotiated_duplex_mode = 9;
// Negotiated Port Speed for the interface
EthPortSpeed negotiated_port_speed = 10;
// Ethernet port counters
EthernetCounters counters = 11;
}

// Ethernet Interface
message EthernetIf {
// Ethernet Interface Configuration settings
EthernetConfig config = 1;
// Ethernet Interface State information
EthernetState state = 2;
// Switched VLAN Interface configuration for interface
VlanSwitchedIf switched_vlan = 3;
}

// Ethernet Duplex Mode Definitions
enum EthDuplexMode {
// Unspecified - interface will negotiate duplex speed directly
ETH_DUPLEX_MODE_UNSPECIFIED = 0;
// Specify Full Duplex mode in autonegotiation
ETH_DUPLEX_MODE_FULL = 1;
// Specify Half Duplex mode in autonegotiation
ETH_DUPLEX_MODE_HALF = 2;
}

// Ethernet Port Speed Definitions
enum EthPortSpeed {
// Unspecified - interface will negotiate port speed with the peer interface
ETH_PORT_SPEED_UNSPECIFIED = 0;
// 10M port speed
ETH_PORT_SPEED_10M = 1;
// 100M port speed
ETH_PORT_SPEED_100M = 2;
// 1G port speed
ETH_PORT_SPEED_1G = 3;
// 2.5G port speed
ETH_PORT_SPEED_2500M = 4;
// 5G port speed
ETH_PORT_SPEED_5G = 5;
// 10G port speed
ETH_PORT_SPEED_10G = 6;
// 25G port speed
ETH_PORT_SPEED_25G = 7;
// 40G port speed
ETH_PORT_SPEED_40G = 8;
// 50G port speed
ETH_PORT_SPEED_50G = 9;
// 100G port speed
ETH_PORT_SPEED_100G = 10;
// 200G port speed
ETH_PORT_SPEED_200G = 11;
// 400G port speed
ETH_PORT_SPEED_400G = 12;
// 600G port speed
ETH_PORT_SPEED_600G = 13;
// 800G port speed
ETH_PORT_SPEED_800G = 14;
// Interface speed is unknown. Systems may report
// speed UNKNOWN when an interface is down or unpopuplated
ETH_PORT_SPEED_UNKNOWN = 15;
}

// Ethernet Forward Error Correction Mode Definitions
enum EthFecMode {
// Unspecified
ETH_FEC_MODE_UNSPECIFIED = 0;
// Firecode for NRZ channels with less then 100G
ETH_FEC_MODE_FC = 1;
// RS528 is used for channels with NRZ modulation. This FEC is designed to
// comply with IEEE 802.3, Clause 91.
ETH_FEC_MODE_RS528 = 2;
// RS544 is used for channels with PAM4 modulation
ETH_FEC_MODE_RS544 = 3;
// RS544-2x-interleave is used for channels with PAM4 modulation
ETH_FEC_MODE_RS544_2X_INTERLEAVE = 4;
// FEC is administratively disabled
ETH_FEC_MODE_DISABLED = 5;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// openconfig_interfaces.proto file
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2023-2024 Dell Inc, or its subsidiaries.
//
// Derived from the OpenConfig interfaces model github.com/openconfig/public/release/models/interfaces
// Copyright (c) 2023 Dell Inc, or its subsidiaries.
//
// (-- api-linter: core::0141::forbidden-types=disabled
// aip.dev/not-precedent: counters, mtu, index must be uint and not int. --)
syntax = "proto3";
Expand All @@ -9,11 +11,14 @@ package opi_api.network.opinetcommon.v1alpha1;

option java_package = "opi_api.network.opinetcommon.v1alpha1";
option java_multiple_files = true;
option java_outer_classname = "OpenconfigInterfacesProto";
option java_outer_classname = "NetworkInterfacesProto";

option go_package = "github.com/opiproject/opi-api/network/opinetcommon/v1alpha1/gen/go";

import "networktypes.proto";
import "networkvlan.proto";
import "networkethernet.proto";

import "google/api/client.proto";
import "google/api/resource.proto";
import "google/api/annotations.proto";
Expand Down Expand Up @@ -65,6 +70,8 @@ message Config {
string description = 5 [(google.api.field_behavior) = REQUIRED];
// Setting for enabling/disabling the interface
bool enabled = 6 [(google.api.field_behavior) = REQUIRED];
// VLAN Tag Protocol Identifier (TPID)
TpidTypes tpid = 7 [(google.api.field_behavior) = OPTIONAL];
}

// Statistics Counters for the interface - ro
Expand Down Expand Up @@ -103,7 +110,7 @@ message Counters {
uint64 out_errors = 16 [(google.api.field_behavior) = OUTPUT_ONLY];
// Carrier transition count
uint64 carrier_transitions = 17 [(google.api.field_behavior) = OUTPUT_ONLY];
// Last Clear
// Timestamp of the last time the interface counters were cleared
uint64 last_clear = 18 [(google.api.field_behavior) = OUTPUT_ONLY];
}

Expand Down Expand Up @@ -132,27 +139,35 @@ message State {
OperState oper_state = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
// Last Change
uint64 last_change = 10 [(google.api.field_behavior) = OUTPUT_ONLY];
// Logical interface
// Logical interface - when set to true indicates a logical interface with
// no associated physical port or channel
bool logical = 11 [(google.api.field_behavior) = OUTPUT_ONLY];
// Management interface indicator
// Management interface - when set to true indicates a dedicated management
// interface that is independent of the dataplane interfaces such as an out
// of band management network
bool management = 12 [(google.api.field_behavior) = OUTPUT_ONLY];
// CPU
// CPU interface - when set to true the interface is for traffic handled by
// the system CPU or control plane
bool cpu = 13 [(google.api.field_behavior) = OUTPUT_ONLY];
// Interface Statistics Counters
Counters counters = 14 [(google.api.field_behavior) = OUTPUT_ONLY];
// VLAN Tag Protocol Identifier
TpidTypes tpid = 15 [(google.api.field_behavior) = OUTPUT_ONLY];
}

//Interface - physical or virtual interface reported
// (-- api-linter: core::0123::resource-annotation=disabled
// aip.dev/not-precedent: the name field is an opaque object --)
message NetInterface {
option (google.api.resource) = {
type: "opi_api.network.common.v1alpha1/NetInterface"
type: "opi_api.network.opinetcommon.v1alpha1/NetInterface"
pattern: "netInterface/{interface}"
singular: "netInterface"
plural: "netInterfaces"
};
// Name of the interface. This is an opaque object that is not
// user settable. It is returned by the created object
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
// Configuration settings - rw
Config config = 2 [(google.api.field_behavior) = REQUIRED];
// Interface State and Statistics - ro
Expand Down Expand Up @@ -204,12 +219,18 @@ message NetInterface {

// Subinterface State and Statistics
State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

// Subinterface VLAN
VlanIf vlan = 4 [(google.api.field_behavior) = OPTIONAL];
}
// Subinterface Settings
repeated Subinterface subinterface = 2 [(google.api.field_behavior) = OPTIONAL];
}
// Subinterfaces assigned to the interface
Subinterfaces subinterfaces = 5 [(google.api.field_behavior) = OPTIONAL];

// Ethernet interface
EthernetIf ethernet = 6 [(google.api.field_behavior) = OPTIONAL];
}

// Get Interface Request
Expand Down Expand Up @@ -246,10 +267,10 @@ message ListNetInterfacesResponse {
message UpdateNetInterfaceRequest {
// Interface update settings
NetInterface net_interface = 1 [(google.api.field_behavior) = REQUIRED];
// The list of fields to update.
google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL];
// If set to true, and the object is not found, a new object will be created.
// In this situation, `update_mask` is ignored.
// list of fields to update
google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL];
// If set to true, and the object is found, a new object will be created.
// In this situation, 'update_mask' is ignored.
bool allow_missing = 3 [(google.api.field_behavior) = OPTIONAL];
}

Expand Down
Loading

0 comments on commit 3559fa1

Please sign in to comment.