1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117
|
<pre>Independent Submission M. Stubbig
Request for Comments: 8522 Independent
Category: Informational February 2019
ISSN: 2070-1721
<span class="h1">Looking Glass Command Set</span>
Abstract
This document introduces a command set standard to the web-based
"Network Looking Glass" software. Its purpose is to provide
application programmers uniform access to the Looking Glass service
and to analyze a standardized response.
The interface is supposed to provide the same level of information as
web-based interfaces, but in a computer-readable format.
Status of This Memo
This document is not an Internet Standards Track specification; it is
published for informational purposes.
This is a contribution to the RFC Series, independently of any other
RFC stream. The RFC Editor has chosen to publish this document at
its discretion and makes no statement about its value for
implementation or deployment. Documents approved for publication by
the RFC Editor are not candidates for any level of Internet Standard;
see <a href="./rfc7841#section-2">Section 2 of RFC 7841</a>.
Information about the current status of this document, any errata,
and how to provide feedback on it may be obtained at
<a href="https://www.rfc-editor.org/info/rfc8522">https://www.rfc-editor.org/info/rfc8522</a>.
Copyright Notice
Copyright (c) 2019 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to <a href="https://www.rfc-editor.org/bcp/bcp78">BCP 78</a> and the IETF Trust's Legal
Provisions Relating to IETF Documents
(<a href="https://trustee.ietf.org/license-info">https://trustee.ietf.org/license-info</a>) in effect on the date of
publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect
to this document.
<span class="grey">Stubbig Informational [Page 1]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span>
<span class="grey"><a href="./rfc8522">RFC 8522</a> Looking Glass Command Set February 2019</span>
Table of Contents
<a href="#section-1">1</a>. Introduction . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-2">2</a>
<a href="#section-1.1">1.1</a>. Background . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-3">3</a>
<a href="#section-1.2">1.2</a>. Syntax Notation . . . . . . . . . . . . . . . . . . . . . <a href="#page-3">3</a>
<a href="#section-1.3">1.3</a>. Examples . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-3">3</a>
<a href="#section-2">2</a>. Operation . . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-4">4</a>
<a href="#section-2.1">2.1</a>. Method Parameters . . . . . . . . . . . . . . . . . . . . <a href="#page-4">4</a>
<a href="#section-2.2">2.2</a>. Query Parameters . . . . . . . . . . . . . . . . . . . . <a href="#page-5">5</a>
<a href="#section-2.3">2.3</a>. Response . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-6">6</a>
<a href="#section-3">3</a>. Functions . . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-9">9</a>
<a href="#section-3.1">3.1</a>. Diagnostic Commands . . . . . . . . . . . . . . . . . . . <a href="#page-9">9</a>
<a href="#section-3.2">3.2</a>. Informational Commands . . . . . . . . . . . . . . . . . <a href="#page-10">10</a>
<a href="#section-3.3">3.3</a>. Organizational Commands . . . . . . . . . . . . . . . . . <a href="#page-14">14</a>
<a href="#section-3.4">3.4</a>. Extensible Commands . . . . . . . . . . . . . . . . . . . <a href="#page-16">16</a>
<a href="#section-4">4</a>. Miscellaneous . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-16">16</a>
<a href="#section-5">5</a>. IANA Considerations . . . . . . . . . . . . . . . . . . . . . <a href="#page-17">17</a>
<a href="#section-5.1">5.1</a>. Well-Known URIs Registry . . . . . . . . . . . . . . . . <a href="#page-17">17</a>
<a href="#section-6">6</a>. Security Considerations . . . . . . . . . . . . . . . . . . . <a href="#page-17">17</a>
<a href="#section-6.1">6.1</a>. Abuse Potential . . . . . . . . . . . . . . . . . . . . . <a href="#page-17">17</a>
<a href="#section-6.2">6.2</a>. Authentication . . . . . . . . . . . . . . . . . . . . . <a href="#page-17">17</a>
<a href="#section-6.3">6.3</a>. Minimal Information . . . . . . . . . . . . . . . . . . . <a href="#page-17">17</a>
<a href="#section-7">7</a>. References . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-18">18</a>
<a href="#section-7.1">7.1</a>. Normative References . . . . . . . . . . . . . . . . . . <a href="#page-18">18</a>
<a href="#section-7.2">7.2</a>. Informative References . . . . . . . . . . . . . . . . . <a href="#page-19">19</a>
<a href="#appendix-A">Appendix A</a>. JSend . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-20">20</a>
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-20">20</a>
<span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. Introduction</span>
Many Internet service providers (ISPs) and Internet exchange points
(IXPs) offer a complimentary web-based service to their customers and
the general public that gives insights to the backbone routing table,
BGP neighbor information, or offered routes. This service is known
as a "Network Looking Glass". Because they utilize a web-based
interface, it is hard to automate access to the services and make
that automation transferable between different service
implementations.
This document describes a common command set to provide application
programmers uniform access to Looking Glass services.
The commands are intended to provide the same level of information as
available via web-based interfaces, but to do so in a computer-
readable format. The intention is that multiple implementers of
Looking Glass services can provide access through these commands so
that an application can make use of the different implementations.
<span class="grey">Stubbig Informational [Page 2]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span>
<span class="grey"><a href="./rfc8522">RFC 8522</a> Looking Glass Command Set February 2019</span>
The command set is split into the following categories: mandatory to
support, optional, and additional. The commands are extensible for
new features and for value-add by implementations.
The Looking Glass command set is described as a language-independent
concept. Consequently, any programming language that satisfies the
commands listed in the following sections is acceptable.
This work is not the output of the IETF and is presented in the hope
that Looking Glass implementers will offer a common programmable
interface.
<span class="h3"><a class="selflink" id="section-1.1" href="#section-1.1">1.1</a>. Background</span>
The requirement of a uniform access to a Looking Glass service
becomes important when multiple Looking Glasses are part of a
monitoring system. Implementing a web client and HTTP parser for
every kind of web-based Looking Glass is a time-consuming workaround.
However, the Looking Glass command set is a much more viable,
compatible, and scalable solution.
<span class="h3"><a class="selflink" id="section-1.2" href="#section-1.2">1.2</a>. Syntax Notation</span>
This specification uses the JavaScript Object Notation (JSON) of
[<a href="./rfc8259" title=""The JavaScript Object Notation (JSON) Data Interchange Format"">RFC8259</a>] arranged as JSend-compliant (Appendix A) responses.
<span class="h3"><a class="selflink" id="section-1.3" href="#section-1.3">1.3</a>. Examples</span>
All URLs in this documentation use the reserved sample domain of
"example.net" as defined in <a href="./rfc6761#section-6.5">Section 6.5 of [RFC6761]</a>.
The URLs further use the fixed [<a href="./rfc5785" title=""Defining Well-Known Uniform Resource Identifiers (URIs)"">RFC5785</a>] prefix of ".well-known/
looking-glass" to prevent a collision in the domain's namespace.
IPv4 addresses use the documentation block of 192.0.2.0/24 [<a href="./rfc5737" title=""IPv4 Address Blocks Reserved for Documentation"">RFC5737</a>]
and IPv6 addresses reside in the reserved prefix of 2001:DB8::/32
[<a href="./rfc3849" title=""IPv6 Address Prefix Reserved for Documentation"">RFC3849</a>]. BGP Autonomous System (AS) numbers are chosen from the
private AS range defined in [<a href="./rfc6996" title=""Autonomous System (AS) Reservation for Private Use"">RFC6996</a>].
The examples skip some required parameters for reasons of simplicity.
<span class="grey">Stubbig Informational [Page 3]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span>
<span class="grey"><a href="./rfc8522">RFC 8522</a> Looking Glass Command Set February 2019</span>
<span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. Operation</span>
A client issues a query using the HTTP GET method to request specific
resources from the server. The resource is a URI and can be
informational or a command execution. The client must present all
necessary parameters for the server to execute the command on the
selected router. Every call is stateless and independent of the
previous one.
The path component of the resource URI must use the prefix of ".well-
known/looking-glass" (see <a href="#section-5.1">Section 5.1</a>) to stay namespace neutral.
The "call" is a request from the client that specifies a predefined
operation ("function") that the server will execute on a selected
router. The "command" is a task executed on the router and initiated
by the server on behalf of the client. The type and scope of all
commands are defined and limited by the server. The client must not
be able to execute random commands on the targeting router. There
must not be any direct communication between the client and the
router.
After the execution of the command on the selected router has
finished, the server replies to the client if the operation has
either succeeded, failed, or timed out. The response is sent to the
client in JSON format. The communication protocol used between the
server and router is not specified by this document; any method
(e.g., Telnet, SSH, NETCONF, serial console) is acceptable.
All parameters and their values are case insensitive.
<span class="h3"><a class="selflink" id="section-2.1" href="#section-2.1">2.1</a>. Method Parameters</span>
Method parameters are mandatory components of the URI and are placed
in the "path" section in terms of [<a href="./rfc7320" title=""URI Design and Ownership"">RFC7320</a>]. Basically, the method
parameters specify the call and determine which command the client
wants to be executed on the selected router.
<span class="grey">Stubbig Informational [Page 4]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-5" ></span>
<span class="grey"><a href="./rfc8522">RFC 8522</a> Looking Glass Command Set February 2019</span>
<span class="h3"><a class="selflink" id="section-2.2" href="#section-2.2">2.2</a>. Query Parameters</span>
Query parameters are optional components of the URI and are placed in
the "query" section in terms of [<a href="./rfc7320" title=""URI Design and Ownership"">RFC7320</a>]. Generally, the query
parameters are additional instructions for the requested command.
protocol
Restrict the command and method parameters to use the specified
protocol and version. Protocol is selected as "Address Family
Identifier" [<a href="#ref-IANA-AFN" title=""Address Family Numbers"">IANA-AFN</a>] [<a href="./rfc4760" title=""Multiprotocol Extensions for BGP-4"">RFC4760</a>] and optionally as "Subsequent
Address Family Identifier" [<a href="#ref-IANA-SAFI">IANA-SAFI</a>] separated by a comma.
Default value is 1,1 (IP version 4, unicast).
JSON datatype is String.
Examples:
* protocol=2,1 (IP version 6, unicast)
* protocol=26 (MPLS, no SAFI used)
router
Run the command on the router identified by its name. This is not
necessarily the router's hostname as long as the Looking Glass
software recognizes it.
Default value is the first router in the list of available
routers.
JSON datatype is String.
Example: router=rbgn06.example.net
routerindex
Run the command on this router identified by its position in the
list of available routers.
Default value is "0".
JSON datatype is Number.
Example: routerindex=8
random
Append a random string to prevent the client (or an intermediate
proxy) from caching the response. The server must ignore its
value.
No default value.
JSON datatype is String.
Example: random=517A93B50
<span class="grey">Stubbig Informational [Page 5]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-6" ></span>
<span class="grey"><a href="./rfc8522">RFC 8522</a> Looking Glass Command Set February 2019</span>
vrf
Run the command from the selected routing table. This parameter
is valid only on routers that support "Virtual Routing and
Forwarding" (VRF).
No default value.
JSON datatype is String.
Example: vrf=mgmt
runtime
Stop executing the command after the runtime limit (in seconds) is
exceeded. A value of 0 disables the limit.
Default value is "30".
JSON datatype is Number.
Example: runtime=60
format
Request the server to provide the output (if any) in the selected
format. Specify multiple formats separated by a comma in
descending order of preference. See <a href="#section-3.3.2">Section 3.3.2</a> for more
details.
Default value is "text/plain" (raw/unformatted output).
JSON datatype is String.
Example: format=application/yang,text/plain
<span class="h3"><a class="selflink" id="section-2.3" href="#section-2.3">2.3</a>. Response</span>
The HTTP response header contains an appropriate HTTP status code as
defined in [<a href="./rfc7231" title=""Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content"">RFC7231</a>] with the Content-Type set to "application/json".
The HTTP body contains details and error descriptions. The response
text must comply with the JSON syntax specification JSend, which is
briefly explained in <a href="#appendix-A">Appendix A</a>. Consequently, every response must
contain a "status" field of either "success", "fail", or "error" as
explained in the following sections.
<span class="h4"><a class="selflink" id="section-2.3.1" href="#section-2.3.1">2.3.1</a>. Success</span>
A successful response must set the "status" field to "success". It
must also contain a "data" object including the following
information:
performed_at
Combined date and time in UTC ISO 8601 [<a href="#ref-iso8601" title=""Data elements and interchange formats - Information interchange - Representation of dates and times"">iso8601</a>] indicating when
the operation finished. This information must be present.
runtime
Amount of seconds (wallclock) used to run the command. This
information must be present.
<span class="grey">Stubbig Informational [Page 6]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-7" ></span>
<span class="grey"><a href="./rfc8522">RFC 8522</a> Looking Glass Command Set February 2019</span>
router
Name of the router that executed the command. This information
may be present.
output
Output of the command in a format that was requested by the
client; it otherwise defaults to raw output as it appeared on the
router's command-line interface (CLI). It might even be blank if
the command did not produce any output. This information should
be present.
format
Selected output format by the server. The client might request
multiple formats so that the "Looking Glass" server has to choose
the best option and tell the client which format was selected.
This information should be present (defaults to "text/plain" if
missing).
Adding more information to the response is permitted and must be
placed inside the "data" object.
The HTTP status code should be 200.
Example:
HTTP/1.1 200 OK
Content-Type: application/json
{
"status" : "success",
"data" : {
"router" : "route-server.lookingglass.example.net"
"performed_at" : "2014-10-15T17:15:34Z",
"runtime" : 2.63,
"output" : [
"full raw output from the observing router..."
],
"format" : "text/plain"
}
}
<span class="h4"><a class="selflink" id="section-2.3.2" href="#section-2.3.2">2.3.2</a>. Fail</span>
A status of "fail" indicates that the selected command was executed
on the router but failed to succeed. The response message must set
the "status" field to "fail" and must contain the "data" object with
command-specific content listed in <a href="#section-2.3.1">Section 2.3.1</a>.
The HTTP status code should be 200.
<span class="grey">Stubbig Informational [Page 7]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-8" ></span>
<span class="grey"><a href="./rfc8522">RFC 8522</a> Looking Glass Command Set February 2019</span>
Example:
HTTP/2.0 200 OK
{
"status" : "fail",
"data" : {
"performed_at" : "2014-10-18T20:04:37Z",
"runtime" : 10.37,
"output" : [
"Sending 5, 100-byte ICMP Echos to 192.0.2.5",
".....",
"Success rate is 0 percent (0/5)"
],
"format" : "text/plain",
"router" : "route-server.lookingglass.example.net"
}
}
<span class="h4"><a class="selflink" id="section-2.3.3" href="#section-2.3.3">2.3.3</a>. Error</span>
The status "error" represents either that the command timed out or
that an error occurred in processing the request. The response
message must set the "status" field to "error" and must contain the
"message" key, which keeps a meaningful message, explaining what went
wrong.
The response may contain the "data" key with required values listed
in <a href="#section-2.3.1">Section 2.3.1</a>. It may also include a "code" field that carries a
numeric code corresponding to the error.
The HTTP status code should be 400 in case of a client-side error,
500 in case of a server-side error, or 502 for errors occurring on
the target router. Code 504 should be used when a command timed out.
Example:
HTTP/1.1 400 Bad Request
{
"status" : "error",
"message" : "Unrecognized host or address."
}
<span class="grey">Stubbig Informational [Page 8]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-9" ></span>
<span class="grey"><a href="./rfc8522">RFC 8522</a> Looking Glass Command Set February 2019</span>
<span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. Functions</span>
The Looking Glass command set provides functions that are either
mandatory to support or optional to implement. The same principle
applies to the web-based Looking Glass.
It is not possible for any function to modify the server's state.
Therefore, all HTTP methods are GET operations.
Variables are templated and expanded in accordance with [<a href="./rfc6570" title=""URI Template"">RFC6570</a>].
<span class="h3"><a class="selflink" id="section-3.1" href="#section-3.1">3.1</a>. Diagnostic Commands</span>
<span class="h4"><a class="selflink" id="section-3.1.1" href="#section-3.1.1">3.1.1</a>. Ping</span>
Send echo messages to validate the reachability of a remote host and
measure round-trip time. The host can be a name or address.
Implementation of the ping command is mandatory.
Syntax: https://example.net/.well-known/looking-glass/v1/ping/{host}
Example query:
GET /.well-known/looking-glass/v1/ping/2001:DB8::35?protocol=2,1
Host: example.net
Example response:
HTTP/1.1 200 OK
{
"status" : "success",
"data" : {
"min" : 40,
"avg" : 41,
"max" : 44,
"rate" : 100,
"output" : [
"Sending 5, 100-byte ICMP Echos to 2001:DB8::35",
"!!!!!",
"Success rate is 100 percent (5/5)"
],
"format" : "text/plain",
"performed_at" : "2014-10-04T14:40:58Z",
"runtime" : 0.77,
"router" : "c2951.lab.lg.example.net"
}
}
<span class="grey">Stubbig Informational [Page 9]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-10" ></span>
<span class="grey"><a href="./rfc8522">RFC 8522</a> Looking Glass Command Set February 2019</span>
<span class="h4"><a class="selflink" id="section-3.1.2" href="#section-3.1.2">3.1.2</a>. Traceroute</span>
Trace the path from the executing router to the destination host and
list all intermediate hops. The host can be a name or address.
Implementation of the traceroute command is optional.
Syntax: https://example.net/.well-known/looking-glass/v1/
traceroute/{host}
Example query:
GET /.well-known/looking-glass/v1/traceroute/192.0.2.8?routerindex=5
Host: example.net
Example response:
HTTP/1.1 200 OK
{
"status": "success",
"data": {
"output": [
"Tracing the route to 192.0.2.8",
"",
" 1 198.51.100.77 28 msec 28 msec 20 msec",
" 2 203.0.113.130 52 msec 40 msec 40 msec",
" 3 192.0.2.8 72 msec 76 msec 68 msec"
],
"format": "text/plain",
"performed_at": "2018-06-10T12:09:31Z",
"runtime": 4.21,
"router": "c7206.lab.lg.example.net"
}
}
<span class="h3"><a class="selflink" id="section-3.2" href="#section-3.2">3.2</a>. Informational Commands</span>
<span class="h4"><a class="selflink" id="section-3.2.1" href="#section-3.2.1">3.2.1</a>. show route</span>
Retrieve information about a specific subnet from the routing table.
Implementation of the "show route" command is mandatory.
Syntax: https://example.net/.well-known/looking-glass/v1/show/
route/{addr}
<span class="grey">Stubbig Informational [Page 10]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-11" ></span>
<span class="grey"><a href="./rfc8522">RFC 8522</a> Looking Glass Command Set February 2019</span>
Example query:
GET /.well-known/looking-glass/v1/show/ [multiline]
route/2001:DB8::/48?protocol=2,1
Host: example.net
Example response:
HTTP/1.1 200 OK
{
"status": "success",
"data": {
"output": [
"S 2001:DB8::/48 [1/0]",
" via FE80::C007:CFF:FED9:17, FastEthernet0/0"
],
"format": "text/plain",
"performed_at": "2018-06-11T17:13:39Z",
"runtime": 1.39,
"router": "c2951.lab.lg.example.net"
}
}
<span class="h4"><a class="selflink" id="section-3.2.2" href="#section-3.2.2">3.2.2</a>. show bgp</span>
Display a matching record from the BGP routing table. This should
include networks, next hop, and may include metric, local preference,
path list, weight, etc.
Implementation of the "show bgp" command is optional.
Syntax: https://example.net/.well-known/looking-glass/v1/show/
bgp/{addr}
Example query:
GET /.well-known/looking-glass/v1/show/bgp/192.0.2.0/24
Host: example.net
<span class="grey">Stubbig Informational [Page 11]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-12" ></span>
<span class="grey"><a href="./rfc8522">RFC 8522</a> Looking Glass Command Set February 2019</span>
Example response:
HTTP/1.1 200 OK
{
"status": "success",
"data": {
"output": [
"BGP routing table entry for 192.0.2.0/24, version 2",
"Paths: (2 available, best #2, table default)",
" Advertised to update-groups:",
" 1",
" Refresh Epoch 1",
" Local",
" 192.0.2.226 from 192.0.2.226 (192.0.2.226)",
" Origin IGP, metric 0, localpref 100, valid, internal",
"[...]"
],
"format": "text/plain",
"performed_at": "2018-06-11T21:47:17Z",
"runtime": 2.03,
"router": "c2951.lab.lg.example.net"
}
}
<span class="h4"><a class="selflink" id="section-3.2.3" href="#section-3.2.3">3.2.3</a>. show bgp summary</span>
Print a summary of BGP neighbor status. This may include the
neighbor BGP ID, autonomous system number, duration of peering,
number of received prefixes, etc.
Implementation of the "show bgp summary" command is optional.
Syntax: https://example.net/.well-known/looking-glass/v1/show/bgp/
summary
Example:
GET /.well-known/looking-glass/v1/show/bgp/summary? [multiline]
protocol=2&routerindex=3
Host: example.net
<span class="grey">Stubbig Informational [Page 12]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-13" ></span>
<span class="grey"><a href="./rfc8522">RFC 8522</a> Looking Glass Command Set February 2019</span>
Example response:
HTTP/1.1 200 OK
{
"status": "success",
"data": {
"output": [
"BGP router identifier 192.0.2.18, local AS number 64501",
"BGP table version is 85298, main routing table version 85298",
"50440 network entries using 867568 bytes of memory",
"[...]",
"Neighbor V AS MsgRcvd MsgSent TblVer Up/Down",
"2001:DB8:91::24 4 64500 481098 919095 85298 41w5d"
],
"format": "text/plain",
"performed_at": "2018-06-11T21:59:21Z",
"runtime": 1.91,
"router": "c2951.lab.lg.example.net"
}
}
<span class="h4"><a class="selflink" id="section-3.2.4" href="#section-3.2.4">3.2.4</a>. show bgp neighbors</span>
Provide detailed information on BGP neighbor connections. Available
details may include neighbor BGP ID, advertised networks, learned
networks, autonomous system number, capabilities, protocol,
statistics, etc.
Implementation of the "show bgp neighbors" command is optional.
Syntax: https://example.net/.well-known/looking-glass/v1/show/bgp/
neighbors/{addr}
Example query:
GET /.well-known/looking-glass/v1/show/bgp/neighbors/192.0.2.226
Host: example.net
<span class="grey">Stubbig Informational [Page 13]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-14" ></span>
<span class="grey"><a href="./rfc8522">RFC 8522</a> Looking Glass Command Set February 2019</span>
Example response:
HTTP/1.1 200 OK
{
"status": "success",
"data": {
"output": [
"BGP neighbor is 192.0.2.226, remote AS 64500, internal link",
" BGP version 4, remote router ID 198.51.100.31",
" BGP state = Established, up for 01:24:06",
"[...]"
],
"format": "text/plain",
"performed_at": "2018-06-11T21:41:17Z",
"runtime": 1.87,
"router": "c2951.lab.lg.example.net"
}
}
<span class="h3"><a class="selflink" id="section-3.3" href="#section-3.3">3.3</a>. Organizational Commands</span>
The following organizational commands must be included in the
implementation.
<span class="h4"><a class="selflink" id="section-3.3.1" href="#section-3.3.1">3.3.1</a>. router list</span>
Provides a full list of routers that are available for command
execution. This list includes the router ID and its name. It is
equivalent to the common "router" HTML drop-down form element and
contains the same information.
Syntax: https://example.net/.well-known/looking-glass/v1/routers
Example response:
{
"status" : "success",
"data" : {
"routers" : [
"route-server.lookingglass.example.net",
"customer-edge.lookingglass.example.net",
"provider-edge.lookingglass.example.net"
],
"performed_at" : "2014-10-19T20:07:01Z",
"runtime" : 0.73
}
}
<span class="grey">Stubbig Informational [Page 14]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-15" ></span>
<span class="grey"><a href="./rfc8522">RFC 8522</a> Looking Glass Command Set February 2019</span>
<span class="h4"><a class="selflink" id="section-3.3.2" href="#section-3.3.2">3.3.2</a>. router details</span>
Lists additional information about the selected router specified by
its router index. The response must contain the router's hostname
and router index. The response may contain more details like output
format, country code, city, administrative contact, vendor, and
model.
Available output formats are specified by Internet media type as of
[<a href="./rfc6838" title=""Media Type Specifications and Registration Procedures"">RFC6838</a>] and listed in [<a href="#ref-IANA-MT" title=""Media Types"">IANA-MT</a>]. If the routers support multiple
formats, they are separated by a comma.
The router might provide output formats that are not yet registered
or listed in [<a href="#ref-IANA-MT" title=""Media Types"">IANA-MT</a>]. For example, output in NETCONF format could
use "text/x.netconf". [<a href="./rfc6838" title=""Media Type Specifications and Registration Procedures"">RFC6838</a>] provides a tree for unregistered
subtypes.
A missing output format defaults to "text/plain", which is a copy of
the raw command-line output.
Syntax: https://example.net/.well-known/looking-glass/v1/
routers/{number}
Example query:
GET /.well-known/looking-glass/v1/routers/1
Host: example.net
Example response:
{
"status" : "success",
"data" : {
"id" : 1,
"name" : "customer-edge.lookingglass.example.net",
"format" : "text/plain,text/x.netconf",
"country" : "de",
"autonomous_system" : 64512
}
}
<span class="h4"><a class="selflink" id="section-3.3.3" href="#section-3.3.3">3.3.3</a>. commands</span>
Provides a full list of commands that are available for execution.
The list includes mandatory to support, optional, and additional
(<a href="#section-3.4">Section 3.4</a>) commands. It is equivalent to the "command" HTML drop-
down or radio-button form element and contains the same information.
<span class="grey">Stubbig Informational [Page 15]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-16" ></span>
<span class="grey"><a href="./rfc8522">RFC 8522</a> Looking Glass Command Set February 2019</span>
The list is formatted as a "commands" array containing one object per
command. This object contains informative strings about the current
command: href, arguments, description, and command.
Syntax: https://example.net/.well-known/looking-glass/v1/cmd
Example response:
{
"status" : "success",
"data" : {
"commands" : [
{
"href" : "https://example.net/.well-known/ [multiline]
looking-glass/v1/show/route",
"arguments" : "{addr}",
"description" : "Print records from IP routing table",
"command" : "show route"
},
{
"href" : "https://example.net/.well-known/ [multiline]
looking-glass/v1/traceroute",
"arguments" : "{addr}",
"description" : "Trace route to destination host",
"command" : "traceroute"
}
]
}
}
<span class="h3"><a class="selflink" id="section-3.4" href="#section-3.4">3.4</a>. Extensible Commands</span>
The list of commands discussed in <a href="#section-3.3.3">Section 3.3.3</a> may be expanded as
long as the principles of this document are observed.
For example, a Looking Glass provider may not be offering BGP-related
commands because of an OSPF-based network.
The sample command might be:
GET /.well-known/looking-glass/v1/show/ospf/database
Host: example.net
<span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. Miscellaneous</span>
The network traffic sent by a "Looking Glass" is not appropriate when
measuring Service Level Agreements or validating Quality of Service
settings.
<span class="grey">Stubbig Informational [Page 16]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-17" ></span>
<span class="grey"><a href="./rfc8522">RFC 8522</a> Looking Glass Command Set February 2019</span>
If a monitoring system uses the Looking Glass command set for
reachability checks, it should not rely on the HTTP status codes but
on the "status" message field inside the HTTP body.
<span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>. IANA Considerations</span>
<span class="h3"><a class="selflink" id="section-5.1" href="#section-5.1">5.1</a>. Well-Known URIs Registry</span>
This specification registers a Well-Known URI [<a href="./rfc5785" title=""Defining Well-Known Uniform Resource Identifiers (URIs)"">RFC5785</a>]:
URI Suffix: looking-glass
Change Controller: M. Stubbig
Reference : This document, <a href="#section-2">Section 2</a>
<span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>. Security Considerations</span>
The use of HTTPS is required to ensure a high level of security,
privacy, and confidentiality during transit.
<span class="h3"><a class="selflink" id="section-6.1" href="#section-6.1">6.1</a>. Abuse Potential</span>
The main goal of the Looking Glass command set is the automated usage
of the Looking Glass service. This allows the scripting of API
calls, which could be used as a Distributed Denial of Service (DDoS)
attack. It is recommended that implementers of the Looking Glass API
take steps to mitigate the above described abuse. The strategy can
include blocking or rate-limiting by client IP address or target IP
network.
<span class="h3"><a class="selflink" id="section-6.2" href="#section-6.2">6.2</a>. Authentication</span>
Authentication is not a requirement because the current Looking Glass
web services are usable without authentication. Requests to the
proposed API service may be authenticated by any method. The
decision is up to the implementer's security requirements.
<span class="h3"><a class="selflink" id="section-6.3" href="#section-6.3">6.3</a>. Minimal Information</span>
Some of the described commands provide a detailed insight into the
provider's network. It is therefore up to the implementer's security
policy to dismiss commands that are marked as "optional" or to
restrict commands that are marked as "mandatory".
<span class="grey">Stubbig Informational [Page 17]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-18" ></span>
<span class="grey"><a href="./rfc8522">RFC 8522</a> Looking Glass Command Set February 2019</span>
<span class="h2"><a class="selflink" id="section-7" href="#section-7">7</a>. References</span>
<span class="h3"><a class="selflink" id="section-7.1" href="#section-7.1">7.1</a>. Normative References</span>
[<a id="ref-IANA-AFN">IANA-AFN</a>] IANA, "Address Family Numbers", <<a href="https://www.iana.org/assignments/address-family-numbers/">https://www.iana.org/</a>
<a href="https://www.iana.org/assignments/address-family-numbers/">assignments/address-family-numbers/</a>>.
[<a id="ref-IANA-MT">IANA-MT</a>] IANA, "Media Types",
<<a href="https://www.iana.org/assignments/media-types/">https://www.iana.org/assignments/media-types/</a>>.
[<a id="ref-IANA-SAFI">IANA-SAFI</a>]
IANA, "Subsequent Address Family Identifiers (SAFI)
Parameters",
<<a href="https://www.iana.org/assignments/safi-namespace/">https://www.iana.org/assignments/safi-namespace/</a>>.
[<a id="ref-JSend">JSend</a>] OmniTI Labs, "JSend", 2014,
<<a href="https://labs.omniti.com/labs/jsend">https://labs.omniti.com/labs/jsend</a>>.
[<a id="ref-RFC4760">RFC4760</a>] Bates, T., Chandra, R., Katz, D., and Y. Rekhter,
"Multiprotocol Extensions for BGP-4", <a href="./rfc4760">RFC 4760</a>,
DOI 10.17487/RFC4760, January 2007,
<<a href="https://www.rfc-editor.org/info/rfc4760">https://www.rfc-editor.org/info/rfc4760</a>>.
[<a id="ref-RFC5785">RFC5785</a>] Nottingham, M. and E. Hammer-Lahav, "Defining Well-Known
Uniform Resource Identifiers (URIs)", <a href="./rfc5785">RFC 5785</a>,
DOI 10.17487/RFC5785, April 2010,
<<a href="https://www.rfc-editor.org/info/rfc5785">https://www.rfc-editor.org/info/rfc5785</a>>.
[<a id="ref-RFC6570">RFC6570</a>] Gregorio, J., Fielding, R., Hadley, M., Nottingham, M.,
and D. Orchard, "URI Template", <a href="./rfc6570">RFC 6570</a>,
DOI 10.17487/RFC6570, March 2012,
<<a href="https://www.rfc-editor.org/info/rfc6570">https://www.rfc-editor.org/info/rfc6570</a>>.
[<a id="ref-RFC7231">RFC7231</a>] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer
Protocol (HTTP/1.1): Semantics and Content", <a href="./rfc7231">RFC 7231</a>,
DOI 10.17487/RFC7231, June 2014,
<<a href="https://www.rfc-editor.org/info/rfc7231">https://www.rfc-editor.org/info/rfc7231</a>>.
[<a id="ref-RFC8259">RFC8259</a>] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data
Interchange Format", STD 90, <a href="./rfc8259">RFC 8259</a>,
DOI 10.17487/RFC8259, December 2017,
<<a href="https://www.rfc-editor.org/info/rfc8259">https://www.rfc-editor.org/info/rfc8259</a>>.
<span class="grey">Stubbig Informational [Page 18]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-19" ></span>
<span class="grey"><a href="./rfc8522">RFC 8522</a> Looking Glass Command Set February 2019</span>
<span class="h3"><a class="selflink" id="section-7.2" href="#section-7.2">7.2</a>. Informative References</span>
[<a id="ref-iso8601">iso8601</a>] International Organization for Standardization, "Data
elements and interchange formats - Information interchange
- Representation of dates and times", December 2004.
[<a id="ref-RFC3849">RFC3849</a>] Huston, G., Lord, A., and P. Smith, "IPv6 Address Prefix
Reserved for Documentation", <a href="./rfc3849">RFC 3849</a>,
DOI 10.17487/RFC3849, July 2004,
<<a href="https://www.rfc-editor.org/info/rfc3849">https://www.rfc-editor.org/info/rfc3849</a>>.
[<a id="ref-RFC5737">RFC5737</a>] Arkko, J., Cotton, M., and L. Vegoda, "IPv4 Address Blocks
Reserved for Documentation", <a href="./rfc5737">RFC 5737</a>,
DOI 10.17487/RFC5737, January 2010,
<<a href="https://www.rfc-editor.org/info/rfc5737">https://www.rfc-editor.org/info/rfc5737</a>>.
[<a id="ref-RFC6761">RFC6761</a>] Cheshire, S. and M. Krochmal, "Special-Use Domain Names",
<a href="./rfc6761">RFC 6761</a>, DOI 10.17487/RFC6761, February 2013,
<<a href="https://www.rfc-editor.org/info/rfc6761">https://www.rfc-editor.org/info/rfc6761</a>>.
[<a id="ref-RFC6838">RFC6838</a>] Freed, N., Klensin, J., and T. Hansen, "Media Type
Specifications and Registration Procedures", <a href="https://www.rfc-editor.org/bcp/bcp13">BCP 13</a>,
<a href="./rfc6838">RFC 6838</a>, DOI 10.17487/RFC6838, January 2013,
<<a href="https://www.rfc-editor.org/info/rfc6838">https://www.rfc-editor.org/info/rfc6838</a>>.
[<a id="ref-RFC6996">RFC6996</a>] Mitchell, J., "Autonomous System (AS) Reservation for
Private Use", <a href="https://www.rfc-editor.org/bcp/bcp6">BCP 6</a>, <a href="./rfc6996">RFC 6996</a>, DOI 10.17487/RFC6996, July
2013, <<a href="https://www.rfc-editor.org/info/rfc6996">https://www.rfc-editor.org/info/rfc6996</a>>.
[<a id="ref-RFC7320">RFC7320</a>] Nottingham, M., "URI Design and Ownership", <a href="https://www.rfc-editor.org/bcp/bcp190">BCP 190</a>,
<a href="./rfc7320">RFC 7320</a>, DOI 10.17487/RFC7320, July 2014,
<<a href="https://www.rfc-editor.org/info/rfc7320">https://www.rfc-editor.org/info/rfc7320</a>>.
<span class="grey">Stubbig Informational [Page 19]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-20" ></span>
<span class="grey"><a href="./rfc8522">RFC 8522</a> Looking Glass Command Set February 2019</span>
<span class="h2"><a class="selflink" id="appendix-A" href="#appendix-A">Appendix A</a>. JSend</span>
According to [<a href="#ref-JSend" title=""JSend"">JSend</a>]:
JSend is a specification that lays down some rules for how JSON
responses from web servers should be formatted. JSend focuses on
application-level (as opposed to protocol- or transport-level)
messaging which makes it ideal for use in REST-style applications
and APIs.
A basic JSend-compliant response must contain a "status" key and
should contain "data", "message", and "code" keys dependent on the
status value. The following table lists the required and optional
keys.
+---------+-----------------+---------------+
| Type | Required keys | Optional keys |
+---------+-----------------+---------------+
| success | status, data | |
| fail | status, data | |
| error | status, message | code, data |
+---------+-----------------+---------------+
Table 1: Type and Keys in JSend Response
Author's Address
Markus Stubbig
Independent
Germany
Email: stubbig.ietf@gmail.com
Stubbig Informational [Page 20]
</pre>
|