Home » Modeling » TMF (Xtext) » reference errors
reference errors [message #1768454] |
Wed, 19 July 2017 01:16 |
Kaushal Patel Messages: 72 Registered: June 2017 |
Member |
|
|
Couldn't resolve reference to TypedefStatement 'counter32'.
Couldn't resolve reference to TypedefStatement 'timestamp'
Couldn't resolve reference to TypedefStatement 'DisplayString'.
I got these errors in my xtext editor.
I am trying to import object type from another xtext editor.
I dont get any errors in default type.
This is my grammar.
TypedefStatement:
'typedef' name=(STRINGARG | KEY_IDENTIFIER )
'{' (typedefsubstatemnet+=TypedefSubstatement)* '}';
TypedefSubstatement:
(TypeStatement
|DescriptionStatement
|ReferenceStatement
|StatusStatement
|DefaultStatement)
;
TypeStatement:
'type' (type=BuiltInType | (pre=STRINGARG':') ? importtype=[TypedefStatement])
(';'
|'{' (typesubstatements+=TypeSubStatement)* '}');
KEY_IDENTIFIER:
=>'value' | =>'status' | =>'namespace' | =>'notification' |=> 'path' |=> 'description' |
=> 'string' | =>'error-message' |=>'config' |=>'range' | =>'revision' | =>'type' |
=>'boolean' | =>'prefix' | =>'range' | => 'key' | =>'fraction-digits';
BuiltInType:
(btype = (
'binary'
| 'bits'
| 'boolean'
| 'decimal64'
| 'empty'
| 'enumeration'
| 'identityref'
| 'instance-identifier'
| 'int8'
| 'int16'
| 'int32'
| 'int64'
| 'leafref'
| 'string'
| 'uint8'
| 'uint16'
| 'uint32'
| 'uint64'
| 'union'
))
;
STRINGARG:
ID | 'default' | CUSTOMSTRING | INT ;
STRINGARG4:
((ID+':'+ID)+(':'+ID) * | (':'KEY_IDENTIFIER)*);
CUSTOMSTRING:
(STRING ('+' STRING)*);
module SNMPv2-TC {
/*** NAMESPACE / PREFIX DEFINITION ***/
namespace "urn:ietf:params:xml:ns:yang:smiv2:SNMPv2-TC";
prefix "snmpv2-tc";
/*** LINKAGE (IMPORTS / INCLUDES) ***/
import ietf-yang-types { prefix yang; }
/*** META INFORMATION ***/
organization
"";
contact
"";
description
"";
/*** TYPE DEFINITIONS ***/
typedef DisplayString {
type string {
length "0..255";
pattern "\p{IsBasicLatin}{0,255}";
}
description
"Represents textual information taken from the NVT ASCII
character set, as defined in pages 4, 10-11 of RFC 854.
To summarize RFC 854, the NVT ASCII repertoire specifies:
- the use of character codes 0-127 (decimal)
- the graphics characters (32-126) are interpreted as
US ASCII
- NUL, LF, CR, BEL, BS, HT, VT and FF have the special
meanings specified in RFC 854
- the other 25 codes have no standard interpretation
- the sequence 'CR LF' means newline
- the sequence 'CR NUL' means carriage-return
- an 'LF' not preceded by a 'CR' means moving to the
same column on the next line.
- the sequence 'CR x' for any x other than LF or NUL is
illegal. (Note that this also means that a string may
end with either 'CR LF' or 'CR NUL', but not with CR.)
Any object defined using this syntax may not exceed 255
characters in length.";
}
typedef PhysAddress {
type string{
pattern "(((([0-9A-Fa-f]{2}))*([0-9A-Fa-f]{2}))){0,1}";
}
description
"Represents media- or physical-level addresses.";
}
typedef MacAddress {
type string {
length "6";
pattern "(((([0-9A-Fa-f]{2})){5,5})([0-9A-Fa-f]{2}))";
}
description
"Represents an 802 MAC address represented in the
`canonical' order defined by IEEE 802.1a, i.e., as if it
were transmitted least significant bit first, even though
802.5 (in contrast to other 802.x protocols) requires MAC
addresses to be transmitted most significant bit first.";
}
typedef TruthValue {
type enumeration {
enum true { value 1; }
enum false { value 2; }
}
description
"Represents a boolean value.";
}
typedef TestAndIncr {
type int32 {
range "0..2147483647";
}
description
"Represents integer-valued information used for atomic
operations. When the management protocol is used to specify
management protocol set operation succeeds, the variable-
binding in the request and response PDUs are identical.)
The value of the ACCESS clause for objects having this
syntax is either `read-write' or `read-create'. When an
instance of a columnar object having this syntax is created,
any value may be supplied via the management protocol.
When the network management portion of the system is re-
initialized, the value of every object instance having this
syntax must either be incremented from its value prior to
the re-initialization, or (if the value prior to the re-
initialization is unknown) be set to a pseudo-randomly
generated value.";
}
typedef AutonomousType {
type yang:object-identifier;
description
"Represents an independently extensible type identification
value. It may, for example, indicate a particular sub-tree
with further MIB definitions, or define a particular type of
protocol or hardware.";
}
typedef InstancePointer {
type yang:object-identifier;
status obsolete;
description
"A pointer to either a specific instance of a MIB object or
a conceptual row of a MIB table in the managed device. In
the latter case, by convention, it is the name of the
particular instance of the first accessible columnar object
in the conceptual row.
The two uses of this textual convention are replaced by
VariablePointer and RowPointer, respectively.";
}
typedef VariablePointer {
type yang:object-identifier;
description
"A pointer to a specific object instance. For example,
sysContact.0 or ifInOctets.3.";
}
typedef RowPointer {
type yang:object-identifier;
description
"Represents a pointer to a conceptual row. The value is the
name of the instance of the first accessible columnar object
in the conceptual row.
For example, ifIndex.3 would point to the 3rd row in the
ifTable (note that if ifIndex were not-accessible, then
ifDescr.3 would be used instead).";
}
typedef RowStatus {
type enumeration {
enum active { value 1; }
enum notInService { value 2; }
enum notReady { value 3; }
enum createAndGo { value 4; }
enum createAndWait { value 5; }
enum destroy { value 6; }
}
description
"The RowStatus textual convention is used to manage the
creation and deletion of conceptual rows, and is used as the
value of the SYNTAX clause for the status column of a
conceptual row (as described in Section 7.7.1 of [2].)
The status column has six defined values:
Conceptual Row Deletion
For deletion of conceptual rows, a management protocol set
operation is issued which sets the instance of the status
column to `destroy'. This request may be made regardless of
the current value of the status column (e.g., it is possible
to delete conceptual rows which are either `notReady',
`notInService' or `active'.) If the operation succeeds,
then all instances associated with the conceptual row are
immediately removed.";
}
typedef TimeStamp {
type yang:timeticks;
description
"The value of the sysUpTime object at which a specific
occurrence happened. The specific occurrence must be
defined in the description of any object defined using this
type.
If sysUpTime is reset to zero as a result of a re-
initialization of the network management (sub)system, then
the values of all TimeStamp objects are also reset.
However, after approximately 497 days without a re-
initialization, the sysUpTime object will reach 2^^32-1 and
then increment around to zero; in this case, existing values
of TimeStamp objects do not change. This can lead to
ambiguities in the value of TimeStamp objects.";
}
typedef TimeInterval {
type int32 {
range "0..2147483647";
}
description
"A period of time, measured in units of 0.01 seconds.";
}
typedef DateAndTime {
type string {
length "8 | 11";
pattern "((0|[1-9](([0-9]){0,4}))(0|[1-9](([0-9]){0,2}))(0|[1-9](([0-9]){0,2}))(0|[1-9](([0-9]){0,2}))(0|[1-9](([0-9]){0,2}))(0|[1-9](([0-9]){0,2}))(0|[1-9](([0-9]){0,2})))|((0|[1-9](([0-9]){0,4}))(0|[1-9](([0-9]){0,2}))(0|[1-9](([0-9]){0,2}))(0|[1-9](([0-9]){0,2}))(0|[1-9](([0-9]){0,2}))(0|[1-9](([0-9]){0,2}))(0|[1-9](([0-9]){0,2}))((\p{IsBasicLatin}){1})(0|[1-9](([0-9]){0,2}))((0|[1-9](([0-9]){0,2}))))";
}
description
"A date-time specification.
field octets contents range
----- ------ -------- -----
1 1-2 year* 0..65536
2 3 month 1..12
3 4 day 1..31
4 5 hour 0..23
5 6 minutes 0..59
6 7 seconds 0..60
(use 60 for leap-second)
7 8 deci-seconds 0..9
8 9 direction from UTC '+' / '-'
9 10 hours from UTC* 0..13
10 11 minutes from UTC 0..59
* Notes:
- the value of year is in network-byte order
- daylight saving time in New Zealand is +13
For example, Tuesday May 26, 1992 at 1:30:15 PM EDT would be
displayed as:
1992-5-26,13:30:15.0,-4:0
Note that if only local time is known, then timezone
information (fields 8-10) is not present.";
}
typedef StorageType {
type enumeration {
enum other { value 1; }
enum volatile { value 2; }
enum nonVolatile { value 3; }
enum permanent { value 4; }
enum readOnly { value 5; }
}
description
"Describes the memory realization of a conceptual row. A
row which is volatile(2) is lost upon reboot. A row which
is either nonVolatile(3), permanent(4) or readOnly(5), is
backed up by stable storage. A row which is permanent(4)
can be changed but not deleted. A row which is readOnly(5)
cannot be changed nor deleted.
If the value of an object with this syntax is either
permanent(4) or readOnly(5), it cannot be written.
Conversely, if the value is either other(1), volatile(2) or
nonVolatile(3), it cannot be modified to be permanent(4) or
readOnly(5). (All illegal modifications result in a
'wrongValue' error.)
Every usage of this textual convention is required to
specify the columnar objects which a permanent(4) row must
at a minimum allow to be writable.";
}
typedef TDomain {
type yang:object-identifier;
description
"Denotes a kind of transport service.
Some possible values, such as snmpUDPDomain, are defined in
the SNMPv2-TM MIB module. Other possible values are defined
in other MIB modules.";
reference
"The SNMPv2-TM MIB module is defined in RFC 1906.";
}
typedef TAddress {
type binary {
length "1..255";
}
description
"Denotes a transport service address.
A TAddress value is always interpreted within the context of a
TDomain value. Thus, each definition of a TDomain value must
be accompanied by a definition of a textual convention for use
with that TDomain. Some possible textual conventions, such as
SnmpUDPAddress for snmpUDPDomain, are defined in the SNMPv2-TM
MIB module. Other possible textual conventions are defined in
other MIB modules.";
reference
"The SNMPv2-TM MIB module is defined in RFC 1906.";
}
} /* end of module SNMPv2-TC */
That's what I am trying to achieve.
But I got the error of
Couldn't resolve reference to TypedefStatement 'timestamp' and more.....
|
|
| |
Re: reference errors [message #1768458 is a reply to message #1768456] |
Wed, 19 July 2017 03:33 |
Kaushal Patel Messages: 72 Registered: June 2017 |
Member |
|
|
This is my file,
ietf-yang-types.snmp
Here, I am using typedef "counter32" as a type of an attribute " zero-based-counter32 "
Same for typedef "counter64".
Now i want to use typedef "object-identifier" as a type of other attributes in different file (SNMPv2-TC.snmp)
I have imported ietf-yang-types in SNMPv2-TC.snmp file.
import ietf-yang-types {
prefix yang;
}
//This is my file ietf-yang-types.snmp
typedef counter32 {
type uint32;
description
"The counter32 type represents a non-negative integer
that monotonically increases until it reaches a
maximum value of 2^32-1 (4294967295 decimal), when it
wraps around and starts increasing again from zero.
Counters have no defined 'initial' value, and thus, a
single value of a counter has (in general) no information
content. Discontinuities in the monotonically increasing
value normally occur at re-initialization of the
management system, and at other times as specified in the
description of a schema node using this type. If such
other times can occur, for example, the creation of
a schema node of type counter32 at times other than
re-initialization, then a corresponding schema node
should be defined, with an appropriate type, to indicate
the last discontinuity.
The counter32 type should not be used for configuration
schema nodes. A default statement SHOULD NOT be used in
combination with the type counter32.
In the value set and its semantics, this type is equivalent
to the Counter32 type of the SMIv2.";
reference
"RFC 2578: Structure of Management Information Version 2
(SMIv2)";
}
typedef zero-based-counter32 {
type counter32;
default "0";
description
"The zero-based-counter32 type represents a counter32
that has the defined 'initial' value zero.
A schema node of this type will be set to zero (0) on creation
and will thereafter increase monotonically until it reaches
a maximum value of 2^32-1 (4294967295 decimal), when it
wraps around and starts increasing again from zero.
Provided that an application discovers a new schema node
of this type within the minimum time to wrap, it can use the
'initial' value as a delta. It is important for a management
station to be aware of this minimum time and the actual time
between polls, and to discard data if the actual time is too
long or there is no defined minimum time.
In the value set and its semantics, this type is equivalent
to the ZeroBasedCounter32 textual convention of the SMIv2.";
reference
"RFC 4502: Remote Network Monitoring Management Information
Base Version 2";
}
typedef counter64 {
type uint64;
description
"The counter64 type represents a non-negative integer
that monotonically increases until it reaches a
maximum value of 2^64-1 (18446744073709551615 decimal),
when it wraps around and starts increasing again from zero.
Counters have no defined 'initial' value, and thus, a
single value of a counter has (in general) no information
content. Discontinuities in the monotonically increasing
value normally occur at re-initialization of the
management system, and at other times as specified in the
description of a schema node using this type. If such
other times can occur, for example, the creation of
a schema node of type counter64 at times other than
re-initialization, then a corresponding schema node
should be defined, with an appropriate type, to indicate
the last discontinuity.
The counter64 type should not be used for configuration
schema nodes. A default statement SHOULD NOT be used in
combination with the type counter64.
In the value set and its semantics, this type is equivalent
to the Counter64 type of the SMIv2.";
reference
"RFC 2578: Structure of Management Information Version 2
(SMIv2)";
}
typedef zero-based-counter64 {
type counter64;
default "0";
description
"The zero-based-counter64 type represents a counter64 that
has the defined 'initial' value zero.
A schema node of this type will be set to zero (0) on creation
and will thereafter increase monotonically until it reaches
a maximum value of 2^64-1 (18446744073709551615 decimal),
when it wraps around and starts increasing again from zero.
Provided that an application discovers a new schema node
of this type within the minimum time to wrap, it can use the
'initial' value as a delta. It is important for a management
station to be aware of this minimum time and the actual time
between polls, and to discard data if the actual time is too
long or there is no defined minimum time.
In the value set and its semantics, this type is equivalent
to the ZeroBasedCounter64 textual convention of the SMIv2.";
reference
"RFC 2856: Textual Conventions for Additional High Capacity
Data Types";
}
typedef object-identifier {
type string {
pattern
'(([0-1](\.[1-3]?[0-9]))|(2\.(0|([1-9]\d*))))(\.(0|([1-9]\d*)))*';
}
description
"The object-identifier type represents administratively
assigned names in a registration-hierarchical-name tree.
Values of this type are denoted as a sequence of numerical
non-negative sub-identifier values. Each sub-identifier
value MUST NOT exceed 2^32-1 (4294967295). Sub-identifiers
are separated by single dots and without any intermediate
whitespace.
The ASN.1 standard restricts the value space of the first
sub-identifier to 0, 1, or 2. Furthermore, the value space
of the second sub-identifier is restricted to the range
0 to 39 if the first sub-identifier is 0 or 1. Finally,
the ASN.1 standard requires that an object identifier
has always at least two sub-identifiers. The pattern
captures these restrictions.
Although the number of sub-identifiers is not limited,
module designers should realize that there may be
implementations that stick with the SMIv2 limit of 128
sub-identifiers.
This type is a superset of the SMIv2 OBJECT IDENTIFIER type
since it is not restricted to 128 sub-identifiers. Hence,
this type SHOULD NOT be used to represent the SMIv2 OBJECT
IDENTIFIER type; the object-identifier-128 type SHOULD be
used instead.";
reference
"ISO9834-1: Information technology -- Open Systems
Interconnection -- Procedures for the operation of OSI
Registration Authorities: General procedures and top
arcs of the ASN.1 Object Identifier tree";
}
typedef object-identifier-128 {
type object-identifier {
pattern '\d*(\.\d*){1,127}';
}
description
"This type represents object-identifiers restricted to 128
sub-identifiers.
In the value set and its semantics, this type is equivalent
to the OBJECT IDENTIFIER type of the SMIv2.";
reference
"RFC 2578: Structure of Management Information Version 2
(SMIv2)";
}
This is SNMPv2-TC.snmp file
typedef AutonomousType {
type yang:object-identifier;
description
"Represents an independently extensible type identification
value. It may, for example, indicate a particular sub-tree
with further MIB definitions, or define a particular type of
protocol or hardware.";
}
typedef InstancePointer {
type yang:object-identifier;
status obsolete;
description
"A pointer to either a specific instance of a MIB object or
a conceptual row of a MIB table in the managed device. In
the latter case, by convention, it is the name of the
particular instance of the first accessible columnar object
in the conceptual row.
The two uses of this textual convention are replaced by
VariablePointer and RowPointer, respectively.";
}
typedef VariablePointer {
type yang:object-identifier;
description
"A pointer to a specific object instance. For example,
sysContact.0 or ifInOctets.3.";
}
typedef RowPointer {
type yang:object-identifier;
description
"Represents a pointer to a conceptual row. The value is the
name of the instance of the first accessible columnar object
in the conceptual row.
For example, ifIndex.3 would point to the 3rd row in the
ifTable (note that if ifIndex were not-accessible, then
ifDescr.3 would be used instead).";
}
You can check my xtetx grammar in above post.
|
|
|
Re: reference errors [message #1768459 is a reply to message #1768458] |
Wed, 19 July 2017 04:45 |
|
as i said:
importtype=[TypedefStatement]
=> TypedefStatement needs a name.
either by giving it a name
or by implementing IQualifiedNameProvider (e.g. subclassing DefaultDeclarativeQualifiedNameProvider)
i dont know the language spec of yang and thus cannot tell you how to implement this
there might be other pitfalls
like a imports and aliases that seem to be part of the language
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
Goto Forum:
Current Time: Tue Mar 19 12:24:28 GMT 2024
Powered by FUDForum. Page generated in 0.02366 seconds
|