Communication method and apparatus, and optical bus network
A communication method and apparatus, and an optical bus network. A controller sends, in response to discovering a target optical head end, a target optical head end identifier to the target optical head end, where the target optical head end identifier identifies the target optical head end. The controller determines a target management protocol from management protocols supported by the target optical head end. The controller communicates target information with the target optical head end based on the target optical head end identifier and the target management protocol, where the target information is used by the controller to manage the target optical head end and/or at least one optical terminal managed by the target optical head end.
1 . A device management method, applied to an optical bus network, the optical bus network comprising a target optical head end and at least one optical terminal managed by the target optical head end, the optical bus network further comprising a controller, and the method comprising:
performing, by the controller, a discovery process for discovering the target optical head end, wherein the discovery process includes broadcasting a discovery packet that includes a destination identifier corresponding to the discovery packet and receiving a discovery packet response from the target optical head end based on the destination identifier;
in response to receiving the discovery packet response, sending, by the controller, a target optical head end identifier to the target optical head end, wherein the target optical head end identifier identifies the target optical head end;
determining, by the controller, a target management protocol from management protocols supported by the target optical head end; and
communicating, by the controller, target information with the target optical head end based on the target optical head end identifier and the target management protocol, wherein the target information is used by the controller to manage the target optical head end and/or the at least one optical terminal managed by the target optical head end.
2 . The method according to claim 1 , wherein the determining, by the controller, the target management protocol includes determining the target management protocol that defines a frame structure of a message that carries the target information, the frame structure includes a header field and a payload field, the target optical head end identifier is located in the header field, and the target information is located in the payload field.
3 . The method according to claim 2 , wherein the determining the target management protocol that defines the frame structure of the message that carries the target information includes determining the target management protocol that defines the frame structure of the message that carries the target information that uses at least one type-length-value TLV structure, wherein a type field in each TLV structure is for carrying type indication information of a managed object, a length field in each TLV structure indicates a length of object content corresponding to the managed object, and a value field in each TLV structure is for carrying the object content.
4 . The method according to claim 2 , wherein the determining the target management protocol that defines the frame structure of the message that carries the target information includes determining the target management protocol defines the frame structure that includes a protocol data unit PDU type field, the PDU type field in the frame structure carries a predetermined value, and the predetermined value indicates that the frame structure is a management protocol frame structure.
5 . The method according to claim 2 , wherein the determining the target management protocol that defines the frame structure of the message that carries the target information includes determining the target management protocol that defines the frame structure that further includes a command indicator, and the command indicator indicates that the frame structure corresponds to any one of the following message types: a read operation, a read response operation, a set operation, a set response operation, or an event report operation.
6 . The method according to claim 2 , wherein the determining the target management protocol that defines the frame structure of the message that carries the target information includes determining the target management protocol that defines the frame structure further includes an event field, and the event field carries alarm event information reported by the target optical head end to the controller.
7 . The method according to claim 1 , wherein the
receiving, by the controller, the discovery packet response includes receiving a media access control MAC address of the target optical head end in the discovery packet response; and
sending, by the controller, the target optical head end identifier to the target optical head end based on the MAC address of the target optical head end.
8 . The method according to claim 1 , wherein the determining, by the controller, the target management protocol from management protocols supported by the target optical head end includes:
receiving, by the controller, first version information from the target optical head end, wherein the first version information indicates a version of each of the management protocols supported by the target optical head end; and
determining, by the controller based on the first version information, the target management protocol from the management protocols supported by the target optical head end.
9 . A communication method, applied to an optical bus network, the optical bus network comprising a target optical head end and at least one optical terminal managed by the target optical head end, the optical bus network further comprising a controller, and the method comprising:
receiving, by the target optical head end, a discovery packet that includes a destination identifier corresponding to the discovery packet and sending a discovery packet response from the target optical head end based on the destination identifier;
in response to sending the discovery packet response, receiving, by the target optical head end, a target optical head end identifier from the controller, wherein the target optical head end identifier is for identifying the target optical head end; and
transmitting, by the target optical head end, target information to the controller based on the target optical head end identifier and a target management protocol, wherein the target information is used by the controller to manage the target optical head end and/or the at least one optical terminal managed by the target optical head end, and the target management protocol is determined by the controller from management protocols supported by the target optical head end.
10 . The method according to claim 9 , wherein the transmitting, by the target optical head end, the target information to the controller based on the target optical head end identifier and the target management protocol includes transmitting target information to the controller based on the target optical head end identifier and the target management protocol that defines a frame structure of a message that carries the target information, the frame structure includes a header field and a payload field, the target optical head end identifier is located in the header field, and the target information is located in the payload field.
11 . The method according to claim 10 , wherein the transmitting target information to the controller includes transmitting the target information that uses at least one type-length-value TLV structure, wherein a type field in each TLV structure carries type indication information of a managed object, a length field in each TLV structure indicates a length of object content corresponding to the managed object, and a value field in each TLV structure carries the object content.
12 . The method according to claim 10 , wherein the transmitting the target information to the controller based on the target optical head end identifier and the target management protocol that defines the frame structure of the message that carries the target information includes transmitting the target information to the controller based on the target optical head end identifier and the target management protocol that defines the frame structure that includes a protocol data unit PDU type field, the PDU type field in the frame structure carries a predetermined value, and the predetermined value indicates that the frame structure is a management protocol frame structure.
13 . The method according to claim 10 , wherein the transmitting the target information to the controller based on the target optical head end identifier and the target management protocol that defines the frame structure of the message that carries the target information includes transmitting the target information to the controller based on the target optical head end identifier and the target management protocol that defines the frame structure that includes a command indicator, and the command indicator indicates that the frame structure corresponds to any one of the following message types: a read operation, a read response operation, a set operation, a set response operation, or an event report operation.
14 . The method according to claim 10 , wherein the transmitting the target information to the controller based on the target optical head end identifier and the target management protocol that defines the frame structure of the message that carries the target information includes transmitting the target information to the controller based on the target optical head end identifier and the target management protocol that defines the frame structure that includes an event field, and the event field carries alarm event information reported by the target optical head end to the controller.
15 . The method according to claim 9 , wherein the
sending, by the target optical head end, the discovery packet response includes sending a MAC address of the target optical head end in the discovery packet response; and
receiving, by the target optical head end, the target optical head end identifier sent by the controller based on the MAC address of the target optical head end.
16 . The method according to claim 9 , wherein the method further comprises:
sending, by the target optical head end, first version information to the controller based on the target optical head end identifier, wherein the first version information indicates a version of each of the management protocols supported by the target optical head end.
17 . A target optical head end, comprising:
a transceiver configured to communicate with another device;
memory storing program instructions; and
a processor connected to the memory, wherein the processor is configured to execute the instructions to perform operations to:
receive, from a controller, a discovery packet that includes a destination identifier corresponding to the discovery packet and sending a discovery packet response to the controller based on the destination identifier;
in response to sending the discovery packet response, receive a target optical head end identifier from the controller, wherein the target optical head end identifier is for identifying the target optical head end; and
transmit target information to the controller based on the target optical head end identifier and a target management protocol, wherein the target information is used by the controller to manage the target optical head end and/or at least one optical terminal managed by the target optical head end, and the target management protocol is determined by the controller from management protocols supported by the target optical head end.
18 . The target optical head end according to claim 17 , wherein the target management protocol defines a frame structure of a message that carries the target information, the frame structure includes a header field and a payload field, the target optical head end identifier is located in the header field, and the target information is located in the payload field.
19 . The target optical head end according to claim 17 , wherein the target information uses at least one type-length-value TLV structure, wherein a type field in each TLV structure carries type indication information of a managed object, a length field in each TLV structure indicates a length of object content corresponding to the managed object, and a value field in each TLV structure carries the object content.
20 . The target optical head end according to claim 18 , wherein the frame structure further includes a protocol data unit PDU type field, the PDU type field in the frame structure carries a predetermined value, and the predetermined value indicates that the frame structure is a management protocol frame structure.