Skip to content

Commit

Permalink
BSC-10447 structuring the eeprom data
Browse files Browse the repository at this point in the history
  • Loading branch information
amospaul-bsn committed May 16, 2018
1 parent f23a5fa commit 84a2b5c
Show file tree
Hide file tree
Showing 5 changed files with 256 additions and 10 deletions.
4 changes: 4 additions & 0 deletions c_gen/c_test_gen.py
Expand Up @@ -108,6 +108,10 @@ def var_name_map(m_type):
of_bitmap_128_t="bitmap_128",
of_bitmap_512_t="bitmap_512",
of_checksum_128_t="checksum_128",
of_bsn_unit_t="bsn_unit",
ofp_bsn_module_eeprom_transceiver_t="bsn_module_eeprom_transceiver",
of_port_desc_prop_bsn_alarm_t="port_desc_prop_bsn_alarm",
of_port_desc_prop_bsn_diag_t="port_desc_prop_bsn_diag",
)

if m_type.find("of_list_") == 0:
Expand Down
20 changes: 20 additions & 0 deletions java_gen/java_type.py
Expand Up @@ -578,6 +578,22 @@ def gen_fixed_length_string_jtype(length):
.op(read='OFTableDescVer$version.READER.readFrom(bb)', \
write='$name.writeTo(bb)')

bsn_unit = JType('OFBsnUnit') \
.op(read='OFBsnUnitVer$version.READER.readFrom(bb)', \
write='$name.writeTo(bb)')

bsn_module_eeprom_transceiver = JType('OFBsnModuleEepromTransceiver') \
.op(read='OFBsnModuleEepromTransceiverVer$version.READER.readFrom(bb)', \
write='$name.writeTo(bb)')

port_desc_prop_bsn_alarm = JType('OFPortDescPropBsnAlarm') \
.op(read='OFPortDescPropBsnAlarm$version.READER.readFrom(bb)', \
write='$name.writeTo(bb)')

port_desc_prop_bsn_diag = JType('OFPortDescPropBsnDiag') \
.op(read='OFPortDescPropBsnDiag$version.READER.readFrom(bb)', \
write='$name.writeTo(bb)')

controller_status_entry = JType('OFControllerStatusEntry') \
.op(read='OFControllerStatusEntryVer$version.READER.readFrom(bb)', \
write='$name.writeTo(bb)')
Expand Down Expand Up @@ -625,6 +641,10 @@ def gen_fixed_length_string_jtype(length):
'of_checksum_128_t': u128,
'of_bsn_vport_t': bsn_vport,
'of_table_desc_t': table_desc,
'of_bsn_unit': bsn_unit,
'ofp_bsn_module_eeprom_transceiver_t': bsn_module_eeprom_transceiver,
'of_port_desc_prop_bsn_alarm_t': port_desc_prop_bsn_alarm,
'of_port_desc_prop_bsn_diag_t': port_desc_prop_bsn_diag,
'of_controller_status_entry_t' : controller_status_entry,
'of_time_t' : of_time,
'of_header_t' : of_message,
Expand Down
228 changes: 228 additions & 0 deletions openflow_input/bsn_port_desc_module_eeprom
@@ -0,0 +1,228 @@
// Copyright 2018, Big Switch Networks, Inc.
//
// LoxiGen is licensed under the Eclipse Public License, version 1.0 (EPL), with
// the following special exception:
//
// LOXI Exception
//
// As a special exception to the terms of the EPL, you may distribute libraries
// generated by LoxiGen (LoxiGen Libraries) under the terms of your choice, provided
// that copyright and licensing notices generated by LoxiGen are not altered or removed
// from the LoxiGen Libraries and the notice provided below is (i) included in
// the LoxiGen Libraries, if distributed in source code form and (ii) included in any
// documentation for the LoxiGen Libraries, if distributed in binary form.
//
// Notice: "Copyright 2013, Big Switch Networks, Inc. This library was generated by the LoxiGen Compiler."
//
// You may not use this file except in compliance with the EPL or LOXI Exception. You may obtain
// a copy of the EPL at:
//
// http://www.eclipse.org/legal/epl-v10.html
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// EPL for the specific language governing permissions and limitations
// under the EPL.
#version 5
#version 6

enum ofp_bsn_unit_type(wire_type=uint8_t, bitmask=False) {
OFP_BSN_UNIT_NONE = 0x0,
OFP_BSN_UNIT_AMP = 0x2,
OFP_BSN_UNIT_VOL = 0x3,
OFP_BSN_UNIT_KM = 0x4,
OFP_BSN_UNIT_M = 0x5,
OFP_BSN_UNIT_S = 0x6,
OFP_BSN_UNIT_C = 0x7,
OFP_BSN_UNIT_F = 0x8
};

struct of_bsn_unit {
uint32_t value;
/* We could probably use an enum to convey the unit */
enum ofp_bsn_unit_type unit;
};

enum ofp_bsn_module_eeprom_recv_signal_type(wire_type=uint8_t, bitmask=False) {
OFP_BSN_MODULE_EEPROM_RECV_SIGNAL_OMA = 0x0,
OFP_BSN_MODULE_EEPROM_RECV_SIGNAL_AVG = 0x1
};

enum ofp_bsn_module_eeprom_diag_type(wire_type=uint8_t, bitmask=False) {
OFP_BSN_MODULE_EEPROM_DIAG_CURR = 0x0,
OFP_BSN_MODULE_EEPROM_DIAG_VOLT = 0x1,
OFP_BSN_MODULE_EEPROM_DIAG_TEMP = 0x2,
OFP_BSN_MODULE_EEPROM_DIAG_RECP = 0x3,
OFP_BSN_MODULE_EEPROM_DIAG_OUTP = 0x4
};

enum ofp_bsn_module_eeprom_identifier(wire_type=uint8_t, bitmask=False) {
OFP_BSN_MODULE_EEPROM_IDENTIFIER_NONE = 0x0,
OFP_BSN_MODULE_EEPROM_IDENTIFIER_GBIC = 0x1,
OFP_BSN_MODULE_EEPROM_IDENTIFIER_ONBOARD = 0x2,
OFP_BSN_MODULE_EEPROM_IDENTIFIER_SFP = 0x3
};

enum ofp_bsn_module_eeprom_extended_identifier(wire_type=uint8_t, bitmask=False) {
OFP_BSN_MODULE_EEPROM_EXT_IDENTIFIER_NON_GBIC = 0x00,
OFP_BSN_MODULE_EEPROM_EXT_IDENTIFIER_GBIC_SFP = 0x04,
OFP_BSN_MODULE_EEPROM_EXT_IDENTIFIER_GBIC_MOD_DEF = 0x07
};

enum ofp_bsn_module_eeprom_connector(wire_type=uint8_t, bitmask=False) {
OFP_BSN_MODULE_EEPROM_CONNECTOR_NONE = 0x00,
OFP_BSN_MODULE_EEPROM_CONNECTOR_SC = 0x01,
OFP_BSN_MODULE_EEPROM_CONNECTOR_FC_1_COPPER = 0x02,
OFP_BSN_MODULE_EEPROM_CONNECTOR_FC_2_COPPER = 0x03,
OFP_BSN_MODULE_EEPROM_CONNECTOR_BNC_TNC = 0x04,
OFP_BSN_MODULE_EEPROM_CONNECTOR_FC_COAX = 0x05,
OFP_BSN_MODULE_EEPROM_CONNECTOR_FIBERE_JACK = 0x06,
OFP_BSN_MODULE_EEPROM_CONNECTOR_LC = 0x07,
OFP_BSN_MODULE_EEPROM_CONNECTOR_MT_RJ = 0x08,
OFP_BSN_MODULE_EEPROM_CONNECTOR_MU = 0x09,
OFP_BSN_MODULE_EEPROM_CONNECTOR_SG = 0x0a,
OFP_BSN_MODULE_EEPROM_CONNECTOR_OPTICAL_PIGTAIL = 0x0b,
OFP_BSN_MODULE_EEPROM_CONNECTOR_MPO_PARALLEL_OPTIC = 0x0c,
OFP_BSN_MODULE_EEPROM_CONNECTOR_HSSDC = 0x20,
OFP_BSN_MODULE_EEPROM_CONNECTOR_COPPER_PIGTAIL = 0x21,
OFP_BSN_MODULE_EEPROM_CONNECTOR_RJ45 = 0x22
};

enum ofp_bsn_module_eeprom_encoding(wire_type=uint8_t, bitmask=False) {
OFP_BSN_MODULE_EEPROM_ENCODING_UNSPECIFIED = 0x00,
OFP_BSN_MODULE_EEPROM_ENCODING_8B_10B = 0x01,
OFP_BSN_MODULE_EEPROM_ENCODING_4B_5B = 0x02,
OFP_BSN_MODULE_EEPROM_ENCODING_NRZ = 0x03,
OFP_BSN_MODULE_EEPROM_ENCODING_MANCHESTER = 0x04,
OFP_BSN_MODULE_EEPROM_ENCODING_SONET_SCRAMBLED = 0x05,
OFP_BSN_MODULE_EEPROM_ENCODING_64B_66B = 0x06
};

enum ofp_bsn_module_eeprom_rate_identifier(wire_type=uint8_t, bitmask=False) {
OFP_BSN_MODULE_EEPROM_RATE_IDENTIFIER_UNSPECIFIED = 0x00,
OFP_BSN_MODULE_EEPROM_RATE_IDENTIFIER_4G_2G_1G_AS0_AS1 = 0x01,
OFP_BSN_MODULE_EEPROM_RATE_IDENTIFIER_8G_4G_2G_RX_RATE_SELECT_ONLY = 0x02,
OFP_BSN_MODULE_EEPROM_RATE_IDENTIFIER_8G_4G_2G_INDEPENDENT_RX_TX = 0x03,
OFP_BSN_MODULE_EEPROM_RATE_IDENTIFIER_8G_4G_2G_TX_RATE_SELECT_ONLY = 0x04
};

enum ofp_bsn_module_eeprom_cu_cmplnce(wire_type=uint8_t, bitmask=False) {
OFP_BSN_MODULE_EEPROM_CU_CMPLLNCE_UNSPECIFIED = 0x00,
OFP_BSN_MODULE_EEPROM_CU_CMPLLNCE_SFF_8431_APP_E = 0x01,
OFP_BSN_MODULE_EEPROM_CU_CMPLLNCE_SFF_8431_LIMITING = 0x04
};

enum ofp_bsn_module_eeprom_alarm_set(wire_type=uint8_t, bitmask=True) {
OFP_BSN_MODULE_EEPROM_ALARM_NOT_SET = 0x00,
OFP_BSN_MODULE_EEPROM_ALARM_HI_SET = 0x01,
OFP_BSN_MODULE_EEPROM_ALARM_LOW_SET = 0x02,
OFP_BSN_MODULE_EEPROM_ALARM_HI_WARN_SET = 0x04,
OFP_BSN_MODULE_EEPROM_ALARM_LOW_WARN_SET = 0x08,
};

struct of_port_desc_prop_bsn_alarm : of_port_desc_prop_bsn {
uint16_t type == 0xffff;
uint16_t length;
uint32_t experimenter == 0x5c16c7;
uint32_t exp_type == 8;
enum ofp_bsn_module_eeprom_alarm_set alarm_set;
uint32_t high;
uint32_t high_warn;
uint32_t low;
uint32_t low_warn;
enum ofp_bsn_module_eeprom_diag_type alarm_type;
/* We could probably use an enum to convey the unit */
enum ofp_bsn_unit_type unit;
};

struct ofp_bsn_module_eeprom_transceiver {
uint64_t codes; /* The codes are in 8 bytes */
//list(of_port_desc_prop_t) info;
};

struct of_port_desc_prop_bsn_diag : of_port_desc_prop_bsn {
uint16_t type == 0xffff;
uint16_t length;
uint32_t experimenter == 0x5c16c7;
uint32_t exp_type == 7;
uint32_t laser_bias_curr;
uint32_t laser_output_power;
enum ofp_bsn_module_eeprom_recv_signal_type laser_receiver_power_type;
uint32_t laser_receiver_power;
uint32_t module_temp;
uint32_t module_voltage;
};
/*
struct ofp_bsn_module_eeprom_passive_cu_cmplnce {
uint16_t type == 0xffff;
uint16_t length;
uint32_t experimenter == 0x5c16c7;
uint32_t exp_type == 13;
enum ofp_bsn_module_eeprom_cu_cmplnce cmplnce;
};

struct ofp_bsn_module_eeprom_active_cu_cmplnce {
uint16_t type == 0xffff;
uint16_t length;
uint32_t experimenter == 0x5c16c7;
uint32_t exp_type == 12;
enum ofp_bsn_module_eeprom_cu_cmplnce cmplnce;
};

struct ofp_bsn_module_eeprom_laser {
uint16_t type == 0xffff;
uint16_t length;
uint32_t experimenter == 0x5c16c7;
uint32_t exp_type == 11;
// TODO: could use a type which specifies the uints
uint32_t wavelength;
};

struct of_port_desc_prop_bsn_ethtool_module_optics {
uint16_t type == 0xffff;
uint16_t length;
uint32_t experimenter == 0x5c16c7;
uint32_t exp_type == 10;
of_octets_t data;
};
*/

struct of_port_desc_prop_bsn_ethtool : of_port_desc_prop_bsn {
uint16_t type == 0xffff;
uint16_t length;
uint32_t experimenter == 0x5c16c7;
uint32_t exp_type == 6;
uint16_t key_length == length(compliance);
/* Available propertties */
enum ofp_bsn_module_eeprom_identifier identifier;
enum ofp_bsn_module_eeprom_extended_identifier extidentifier;
enum ofp_bsn_module_eeprom_connector connector;
/* TODO: Transceiver */
//of_bsn_unit_t transdata;
ofp_bsn_module_eeprom_transceiver_t transdata;
enum ofp_bsn_module_eeprom_encoding encoding;
/* TODO: BR nominal could be sent with units*/
uint32_t br_nominal;
enum ofp_bsn_module_eeprom_rate_identifier rateidentifier;
/* The following lengths could be represented as values with units */
uint32_t length_SMF_KM;
uint32_t length_SMF;
uint32_t length_50_um;
uint32_t length_625_um;
uint32_t length_copper;
uint32_t length_OM3;

//of_port_desc_prop_bsn_ethtool_module_compliance_t cmplnce;

uint64_t vendor_name_lo; /* Vendor name as ASCII */
uint64_t vendor_name_hi; /* Vendor name as ASCII */
uint32_t vendor_oui; /* a list of 3 bytes */
uint64_t vendor_pn_lo; /* Vendor PN as ASCII */
uint64_t vendor_pn_hi; /* Vendor PN as ASCII */
uint32_t vendor_rev; /* Vendor revision as ASCII */

//list(of_port_desc_prop_t) compliance;
/* module eeprom can have opt diagnostics optionally */
list(of_port_desc_prop_t) more_properties;
};
10 changes: 0 additions & 10 deletions openflow_input/bsn_port_desc_properties
Expand Up @@ -75,13 +75,3 @@ struct of_port_desc_prop_bsn_misc_capabilities : of_port_desc_prop_bsn {
uint64_t supported; /* All miscellaneous capabilities of port
* supported by HW */
};

struct of_port_desc_prop_bsn_ethtool : of_port_desc_prop_bsn {
uint16_t type == 0xffff;
uint16_t length;
uint32_t experimenter == 0x5c16c7;
uint32_t exp_type == 6;
of_octets_t data; /* ethtool -m <if> result */
/* intended to be decoded by the requestor */
/* available on ethool managed interfaces */
};
4 changes: 4 additions & 0 deletions py_gen/oftype.py
Expand Up @@ -149,6 +149,10 @@
'of_meter_features_t': 'ofp.meter_features',
'of_bsn_vport_t': 'ofp.bsn_vport',
'of_table_desc_t': 'ofp.table_desc',
'of_bsn_unit_t': 'ofp.bsn_unit',
'ofp_bsn_module_eeprom_transceiver_t': 'ofp.bsn_module_eeprom_transceiver',
'of_port_desc_prop_bsn_alarm_t': 'ofp.port_desc_prop_bsn_alarm',
'of_port_desc_prop_bsn_diag_t': 'ofp.port_desc_prop_bsn_diag',
'of_stat_t': 'ofp.stat',
}

Expand Down

0 comments on commit 84a2b5c

Please sign in to comment.