openBackhaul / core

Core Information Model that consolidates all technology specific extension
Apache License 2.0
1 stars 0 forks source link

manufacture-date is not date and time #12

Closed michbin closed 1 year ago

michbin commented 4 years ago

The manufacture-date element is a simple date without time (or even less, e.g. "2019-11"). Thus, the yang:date-and-time type cannot be used.

demx8as6 commented 3 years ago

Even the time is not required - yang:date-and-time could be used, by setting hours, minutes and seconds to 0.

example

As alternative a new common type definition should be defined:

typedef date {
  type string {
    pattern
      '^\d{4}-\d{2}-\d{2}?(Z|[\+\-]\d{2}:\d{2})$';
  }

alternative

PrathibaJee commented 2 years ago

The current UML2YANG tool don't support the pattern substatment. We need to enhance the tool to include this support.

To support pattern substatement : From TR-531_UML-YANG_Mapping_Gdls_v1.1-1 , page 21 , the pattern substatement shall be implemented by manipulating the UML Artifact OpenModelAttribute::valueRange.

image

Correspondingly , in the UML2YANG tool , this translation can be implemented as below ,

if OpenModelAttribute::valueRange has value other than "null" or "NA" 
then 
if value is an integer 
then 
length substatement shall be included
else
pattern substatement shall be included

Alternate proposal : This pattern shall be included in the description of the attribute. Example : attribute protocol-group-type/protocol-id in vlan-fd-1-0.yang

alexandrustancu commented 2 years ago

-P-r-o-p-o-s-a-l- -t-o- -t-h-e- -5-G---x-h-a-u-l- -c-a-l-l- -on- -2-8-t-h- -o-f- -S-e-p-t-e-m-b-e-r- -2-0-2-2:

Add a new typedef in the core-model, describing a date, and modify manufacture-date to use that type.

typedef date {
  type string {
    pattern
      '^\d{4}-\d{2}-\d{2}$';
  }
 description
  "The date type is a profile of the ISO 8601
      standard for representation of dates using the
      Gregorian calendar.  The profile is defined by the
      full-date production in Section 5.6 of RFC 3339.";
 reference
 "RFC 3339: Date and Time on the Internet: Timestamps";

The date described as YYYY-MM-DD is according to RFC 3339 Section 5.6, which uses the date format in accordance with ISO 8601 standard.

Using the newly proposed date definition instead of the existing date-time is also in accordance with RFC 6933 Section 2.12.1

In the pruning and refactoring step the tool should add the type-definition for a "date" and the type for the attribute manufacture-date needs to be changed to the new "date" type.

openBackhaul commented 1 year ago

Decision made at th e5G-xhaul call on 12th of October 2022:

The EquipmentInstance::manufactureDate : String attribute (which is automatically translated into datatype IETF YANG DateAndTime), shall be represented as a String in YANG in future and the description shall change from "This attribute represents the date on which this instance is manufactured." towards "This attribute represents the date on which this instance is manufactured. The date type is a profile of the ISO 8601 standard for representation of dates using the Gregorian calendar. The profile is defined by the full-date production in Section 5.6 of RFC 3339. Values shall follow the pattern: ^\\d{4}-\\d{2}-\\d{2}$ . Reference: RFC 3339: Date and Time on the Internet: Timestamps". These changes shall be executed during the UML2YANG tooling and will not be documented in any UML.

Info per 2022-10-04. No default values are added by tooling to the core-model - and we keep it like this.

openBackhaul commented 1 year ago

Implemented as decided.