From 936dfd720a7a0d637bce157983790ec66241a0d0 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 31 Jan 2021 19:36:06 +0100 Subject: [PATCH] Further clean-up in osmo-sgsn -> osmo-gbproxy migration * fix manuals builds, including vty reference generation * fix vty tests * remove manuals from osmo-sgsn * update .gitreview * update osmoappdesc.py Related: OS#4992 Change-Id: I80439ab0d21a3fb33f38da42acbfe3fbb0941b91 --- .gitreview | 2 +- Makefile.am | 2 +- doc/manuals/Makefile.am | 25 +- doc/manuals/chapters/configuration.adoc | 378 --- doc/manuals/chapters/control.adoc | 23 - doc/manuals/chapters/counters.adoc | 4 - doc/manuals/chapters/counters_generated.adoc | 96 +- doc/manuals/chapters/overview.adoc | 109 - doc/manuals/chapters/running.adoc | 35 - doc/manuals/osmogbproxy-usermanual.adoc | 2 +- doc/manuals/osmogbproxy-vty-reference.xml | 2 +- doc/manuals/osmosgsn-usermanual-docinfo.xml | 54 - doc/manuals/osmosgsn-usermanual.adoc | 40 - doc/manuals/osmosgsn-vty-reference.xml | 44 - doc/manuals/regen_doc.sh | 15 +- .../gbproxy_vty_additions.xml | 0 .../gbproxy_vty_reference.xml | 641 ++-- doc/manuals/vty/sgsn_vty_additions.xml | 6 - doc/manuals/vty/sgsn_vty_reference.xml | 2677 ----------------- osmoappdesc.py | 12 +- src/gb_proxy_main.c | 35 + tests/Makefile.am | 4 +- tests/vty_test_runner.py | 176 +- 23 files changed, 390 insertions(+), 3992 deletions(-) delete mode 100644 doc/manuals/chapters/configuration.adoc delete mode 100644 doc/manuals/chapters/control.adoc delete mode 100644 doc/manuals/chapters/counters.adoc delete mode 100644 doc/manuals/chapters/overview.adoc delete mode 100644 doc/manuals/chapters/running.adoc delete mode 100644 doc/manuals/osmosgsn-usermanual-docinfo.xml delete mode 100644 doc/manuals/osmosgsn-usermanual.adoc delete mode 100644 doc/manuals/osmosgsn-vty-reference.xml rename doc/manuals/{vty-osmogbproxy => vty}/gbproxy_vty_additions.xml (100%) rename doc/manuals/{vty-osmogbproxy => vty}/gbproxy_vty_reference.xml (78%) delete mode 100644 doc/manuals/vty/sgsn_vty_additions.xml delete mode 100644 doc/manuals/vty/sgsn_vty_reference.xml diff --git a/.gitreview b/.gitreview index 560ddef1..06de5499 100644 --- a/.gitreview +++ b/.gitreview @@ -1,3 +1,3 @@ [gerrit] host=gerrit.osmocom.org -project=osmo-sgsn +project=osmo-gbproxy diff --git a/Makefile.am b/Makefile.am index 47988ca2..bb4758b5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -9,9 +9,9 @@ AM_CPPFLAGS = \ $(NULL) SUBDIRS = \ - doc \ include \ src \ + doc \ contrib \ tests \ $(NULL) diff --git a/doc/manuals/Makefile.am b/doc/manuals/Makefile.am index cd57cf14..fa342ab8 100644 --- a/doc/manuals/Makefile.am +++ b/doc/manuals/Makefile.am @@ -1,23 +1,26 @@ -EXTRA_DIST = osmosgsn-usermanual.adoc \ - osmosgsn-usermanual-docinfo.xml \ - osmosgsn-vty-reference.xml \ +EXTRA_DIST = \ osmogbproxy-usermanual.adoc \ osmogbproxy-usermanual-docinfo.xml \ - regen_doc.sh \ - chapters \ - vty \ osmogbproxy-vty-reference.xml \ - vty-osmogbproxy \ + chapters \ + regen_doc.sh \ + vty \ $(NULL) if BUILD_MANUALS - ASCIIDOC = osmosgsn-usermanual.adoc osmogbproxy-usermanual.adoc - ASCIIDOC_DEPS = $(srcdir)/chapters/*.adoc + ASCIIDOC = osmogbproxy-usermanual.adoc include $(OSMO_GSM_MANUALS_DIR)/build/Makefile.asciidoc.inc + osmogbproxy-usermanual.pdf: $(srcdir)/chapters/*.adoc #$(srcdir)/chapters/*.dot + + VTY_REFERENCE = osmogbproxy-vty-reference.xml + + BUILT_REFERENCE_XML = $(builddir)/vty/gbproxy_vty_reference.xml + $(builddir)/vty/gbproxy_vty_reference.xml: $(top_builddir)/src/osmo-gbproxy + mkdir -p $(builddir)/vty + $(top_builddir)/src/osmo-gbproxy --vty-ref-xml > $@ - VTY_REFERENCE = osmosgsn-vty-reference.xml osmogbproxy-vty-reference.xml include $(OSMO_GSM_MANUALS_DIR)/build/Makefile.vty-reference.inc - OSMO_REPOSITORY = osmo-sgsn + OSMO_REPOSITORY = osmo-gbproxy include $(OSMO_GSM_MANUALS_DIR)/build/Makefile.common.inc endif diff --git a/doc/manuals/chapters/configuration.adoc b/doc/manuals/chapters/configuration.adoc deleted file mode 100644 index 7d3072ec..00000000 --- a/doc/manuals/chapters/configuration.adoc +++ /dev/null @@ -1,378 +0,0 @@ -== Configuring OsmoSGSN - -Contrary to other network elements (like OsmoBSC, OsmoNITB), the -OsmoSGSN has a relatively simple configuration. - -On the one hand, this is primary because the PCU configuration happens -from the BSC side. - -On the other hand, it is because the Gb interface does not need an -explicit configuration of each PCU connecting to the SGSN. The -administrator only has to ensure that the NS and BSSGP layer identities -(NSEI, NSVCI, BVCI) are unique for each PCU connecting to the SGSN. - -=== Configuring the Gp interface - -The Gp interface is the GTP-C and GTP-U based interface between the SGSN -and the GGSNs. It is implemented via UDP on well-known source and -destination ports. - -When an MS requests establishment of a PDP context, it specifies the APN -(Access Point Name) to which the context shall be established. This APN -determines which GGSN shall be used, and that in turn determines which -external IP network the MS will be connected to. - -There are two modes in which GGSNs can be configured: - -. static GGSN/APN configuration -. dynamic GGSN/APN configuration - -==== Static GGSN/APN configuration - -In this mode, there is a static list of GGSNs and APNs configured in -OsmoSGSN via the VTY / config file. - -This is a non-standard method outside of the 3GPP specifications for the -SGSN, and is typically only used in private/small GPRS networks without -any access to a GRX. - -.Example: Static GGSN/APN configuration (single catch-all GGSN) ----- -OsmoSGSN(config-sgsn)# gtp local-ip 172.0.0.1 <1> -OsmoSGSN(config-sgsn)# ggsn 0 remote-ip 127.0.0.2 <2> -OsmoSGSN(config-sgsn)# ggsn 0 gtp-version 1 <3> -OsmoSGSN(config-sgsn)# apn * ggsn 0 <4> ----- -<1> Configure the local IP address at the SGSN used for Gp/GTP -<2> Specify the remote IP address of the GGSN (for GGSN 0) -<3> Specify the GTP protocol version used for GGSN 0 -<4> Route all APN names to GGSN 0 - - -==== Dynamic GGSN/APN configuration - -In this mode, the SGSN will use a DNS-based method to perform the lookup -from the APN (as specified by the MS) towards the GGSN IP address. - -This is the official method as per the 3GPP specifications for the SGSN, -and what is used on GRX. - -.Example: Dynamic GGSN/APN configuration ----- -OsmoSGSN(config-sgsn)# gtp local-ip 192.168.0.11 <1> -OsmoSGSN(config-sgsn)# ggsn dynamic <2> -OsmoSGSN(config-sgsn)# grx-dns-add 1.2.3.4 <3> ----- -<1> Configure the local IP address at the SGSN used for Gp/GTP -<2> Enable the dynamic GGSN resolving mode -<3> Specify the IP address of a DNS server for APN resolution - -[[auth-pol]] -=== Authorization Policy - -The authorization policy controls by which rules a subscriber is accepted or -rejected. The possible options range from accepting just all subscribers without -further checking, to a fine grained access-control, handled by an external HLR. - -accept-all:: All subscribers that attempt to attach to the GPRS network are -accepted without further checking. This option is intended to be used for -testing in a controlled environment only. A wide-open network may attract -subscribers from foreign networks and disrupt their service. It is highly -recommended to pick one of the options below. - -remote:: This option allows to connect OsmoSGSN to an external HLR via the -GSUP protocol. This will be the preferred option in larger networks. - -acl-only:: If no external HLR is available, the network operator has the -option to control the access using an access control list. The access control -list contains the IMSI numbers of the allowed subscribers. This method offers -fine grained access control and is ideal for small networks and lab test -environments. - -closed:: This policy mode softens the strict *acl-only* only mode by also -implicitly accepting home network subscribers. The decision is made by the MCC -and MNC part of the IMSI number. The combination of MCC and MNC fully identifies -a subscribers home network, also known as a Home Network Identity (HNI, i.e. -MCC and MNC found at the start of the IMSI, e.g. MCC 901 and MNC 700 with -IMSI 901700000003080). - -NOTE: The policy mode *closed* must not be confused with the equally named -policy that is defined for osmo-nitb! - - -.Example: Assign or change authorization policy ----- -OsmoSGSN> enable -OsmoSGSN# configure terminal -OsmoSGSN(config)# sgsn -OsmoSGSN(config-sgsn)# auth-policy acl-only <1> -OsmoSGSN(config-sgsn)# write <2> -Configuration saved to sgsn.cfg -OsmoSGSN(config-sgsn)# end -OsmoSGSN# disable -OsmoSGSN> ----- -<1> 'acl-only' is selected as authorization policy -<2> Saves current changes to cofiguration to make this policy -persistent - -.Example: Access control list ----- -sgsn - auth-policy acl-only <1> - imsi-acl add 001010000000003 - imsi-acl add 001010000000002 - imsi-acl add 001010000000001 - imsi-acl add 901700000000068 <2> ----- -<1> Set the authorization policy -<2> Add as many subscribers as required - -=== Subscriber Configuration - -As opposed to OsmoNITB, OsmoSGSN does not feature a built-in HLR. - -It can thus operate only in the following two modes: - -. Accessing an external HLR (or HLR gateway) via the GSUP protocol -. Accepting subscribers based on internal ACL (access control list), - see also <> - -==== Accessing an external HLR via GSUP - -The non-standard GSUP protocol was created to provide OsmoSGSN with -access to an external HLR while avoiding the complexities of the -TCAP/MAP protocol stack commonly used by HLRs. - -A custom HLR could either directly implement GSUP, or an external gateway -can be used to convert GSUP to the respective MAP operations. - -The primitives/operations of GSUP are modelled to have a 1:1 -correspondence to their MAP counterparts. However, the encoding is much -simplified by use of a binary TLV encoding similar to Layer 3 of -GSM/GPRS. - -GSUP performs a challenge-response authentication protocol called OAP, -which uses the standard MILENAGE algorithm for mutual authentication -between OsmoSGSN and the HLR/HLR-GW. - -[[sgsn-ex-gsup]] -.Example: Using an external HLR via GSUP ----- -OsmoSGSN(config-sgsn)# gsup remote-ip 2.3.4.5 <1> -OsmoSGSN(config-sgsn)# gsup remote-port 10000 <2> -OsmoSGSN(config-sgsn)# gsup oap-k 000102030405060708090a0b0c0d0e0f <3> -OsmoSGSN(config-sgsn)# gsup oap-opc 101112131415161718191a1b1c1d1e1f <4> ----- -<1> Configure the IP address of the (remote) HLR or HLR-GW -<2> Configure the TCP port of the (remote) HLR or HLR-GW -<3> Specify the OAP shared key -<4> Specify the OAP shared OPC - - -=== CDR configuration - -OsmoSGSN can write a text log file containing CDR (call data records), -which are commonly used for accounting/billing purpose. - -.Example: CDR log file configuration ----- -OsmoSGSN(config-sgsn)# cdr filename /var/log/osmosgsn.cdr -OsmoSGSN(config-sgsn)# cdr interval 600 <1> ----- -<1> Periodically log existing PDP contexts every 600 seconds (10 min) - -The CDR file is a simple CSV file including a header line naming the -individual fields of each CSV line. - -==== CDR CTRL interface - -Independently of whether logging CDR to a file is enabled or not, OsmoSGSN can -also provide delivery of CDR through the CTRL interface. CDR are sent by means -of TRAP messages with variable name _cdr-v1_, and its value is filled using the -same CSV line format as in the log file, but without CSV header line. - -.Example: CDR delivery through CTRL TRAP messages ----- -OsmoSGSN(config-sgsn)# cdr trap ----- - -==== CDR Format - -[[sgsn-cdr]] -.Description of CSV fields in OsmoSGSN CDR file -[options="header",cols="15%,85%"] -|=== -|Field Name|Description -|timestamp|Timestamp in YYYYMMDDhhmmssXXX where XXX are milli-seconds -|imsi|IMSI causing this CDR -|imei|IMEI causing this CDR -|msisdn|MSISDN causing this CDR (if known) -|cell_id|Cell ID in which the MS was registered last -|lac|Location Area Code in which the MS was registered last -|hlr|HLR of the subscriber -|event|Possible events are explained below in <> -|=== - -If the _event_ field describes a pdp context related action (starts with -_pdp-_), then the following extra CSV fields are appended to the line: - -[[sgsn-cdr-pdp]] -.Description of extra CSV fields for pdp context related events -[options="header",cols="15%,85%"] -|=== -|Field Name|Description -|pdp_duration|duration of the PDP context so far -|ggsn_addr|GGSN related to the PDP context -|sgsn_addr|SGSN related to the PDP context -|apni|APN identifier of the PDP context -|eua_addr|IP address allocated to the PDP context -|vol_in|Number of bytes in MO direction -|vol_out|Number of bytes in MT direction -|charging_id|Related charging ID -|=== - -[[sgsn-cdr-event]] -.Description of OsmoSGSN CDR Events -[options="header",cols="15%,85%"] -|=== -|Event|Description -|attach|GMM ATTACH COMPLETE about to be sent to MS -|update|GMM ROUTING AREA UPDATE COMPLETE about to be sent to MS -|detach|GMM DETACH REQUEST received from MS -|free|Release of the MM context memory -|pdp-act|GTP CREATE PDP CONTEXT CONFIRM received from GGSN -|pdp-deact|GTP DELETE PDP CONTEXT CONFIRM received from GGSN -|pdp-terminate|Forced PDP context termination during MM context release -|pdp-free|Release of the PDP context memory -|pdp-periodic|Triggered by periodic timer, see VTY cmd _cdr interval_ -|=== - - -=== User traffic compression - -In order to save GPRS bandwith, OsmoSGSN implements header and data -compression schemes which will reduce the packet length. - -==== Header compression - -On TCP/IP connections, each packet is prepended with a fairly long TCP/IP -header. The header contains a lot of static information that never changes -throughout the connection. (source and destination address, port numbers etc.) -OsmoSGSN implements a TCP/IP header compression scheme called RFC1144, also -known as SLHC. This type of header compression removes the TCP/IP header -entirely and replaces it with a shorter version, that only contains the -information that is absolutely necessary to identify and check the packet. -The receiving part then restores the original header and forwards it to higher -layers. - -*compression rfc1144 passive*:: -TCP/IP header compression has to be actively requested by the modem. The -network will not promote compression by itself. This is the recommended mode -of operation. - -*compression rfc1144 active slots <1-256>*:: -TCP/IP header compression is actively promoted by the network. Modems may still -actively request different compression parameters or reject the offered -compression parameters entirely. The number of slots is the maximum number -of packet headers per subscriber that can be stored in the codebook. - -.Example: Accept compression if requested ----- -sgsn - compression rfc1144 passive ----- - -.Example: Actively promote compression ----- -sgsn - compression rfc1144 active slots 8 ----- - -.Example: Turn off compression ----- -sgsn - no compression rfc1144 ----- - -NOTE: The usage of TCP/IP options may disturb the RFC1144 header compression -scheme. TCP/IP options may render RFC1144 ineffective if variable data is -encoded into the option section of the TCP/IP packet. (e.g. TCP option 8, -Timestamp) - - -==== Data compression - -Data compression works on the raw packet data, including the header part of the -packet. If enabled, header compression is applied first before data compression -is applied. OsmoSGSN implements the V.42bis data compression scheme. - -*compression v42bis passive*:: -V42bis data compression has to be actively requested by the modem. The network -will not promote compression by itself. This is the recommended mode of -operation. - -*compression v42bis active direction (ms|sgsn|both) codewords <512-65535> strlen <6-250>*:: -V42bis data compression is actively promoted by the network. Modems may still -actively request different compression parameters or reject the offered -compression parameters entirely. The direction configures which sides are -allowed to send compressed packets. For most cases, compressing 'both' -directions will be the preferred option. The following to parameters configure -the codebook size by the maxium number ('codewords') and size ('strlen') of -entries. - -.Example: Accept compression if requested ----- -sgsn - compression v42bis passive ----- - -.Example: Actively promote compression ----- -sgsn - compression v42bis active direction both codewords 512 strlen 20 ----- - -.Example: Turn off compression ----- -sgsn - no compression v42bis ----- - -=== Encryption - -Encryption can be enabled if the auth-policy is set to remote and the -HLR subscriber entries contain the keys of the SIM card. See -<> on how to connect to an external HLR. - -.Example: Turn on encryption (GEA3) ----- -sgsn - encryption GEA3 ----- - -.Example: Turn off encryption (GEA0) ----- -sgsn - encryption GEA0 ----- - -=== Configure SCCP/M3UA to accept _IuPS_ links - -OsmoSGSN acts as client to contact an STP instance and establish an SCCP/M3UA -link. - -An example configuration of OsmoSGSN's SCCP link: - ----- -cs7 instance 0 - point-code 0.23.4 - asp asp-clnt-OsmoSGSN 2905 0 m3ua - remote-ip 127.0.0.1 - sctp-role client - as as-clnt-OsmoSGSN m3ua - asp asp-clnt-OsmoSGSN - routing-key 0 0.23.4 ----- - -This configuration is explained in detail in <>. diff --git a/doc/manuals/chapters/control.adoc b/doc/manuals/chapters/control.adoc deleted file mode 100644 index 0f2bfae0..00000000 --- a/doc/manuals/chapters/control.adoc +++ /dev/null @@ -1,23 +0,0 @@ -[[control]] -== Control interface - -The actual protocol is described in <>, the variables -common to all programs using it are described in <>. Here we -describe variables specific to OsmoSGSN. - -.Variables available over control interface -[options="header",width="100%",cols="20%,5%,5%,50%,20%"] -|=== -|Name|Access|Trap|Value|Comment -|subscriber-list-active-v1|RO|No|","|See <> for details. -|=== - -[[subs]] -=== subscriber-list-active-v1 - -Return the list of active subscribers as a concatenated set of pairs "", -"addr" where first element of the pair is subscriber's IMSI and the second -element (which might be empty) is the subscriber's address. The address value -might be "none", "invalid" and "PPP" in addition to actual IP address. In case -of IP address it will be prefixed with "IPv4" or "IPv6" string depending on the -version of IP protocol. diff --git a/doc/manuals/chapters/counters.adoc b/doc/manuals/chapters/counters.adoc deleted file mode 100644 index 7fbb10c6..00000000 --- a/doc/manuals/chapters/counters.adoc +++ /dev/null @@ -1,4 +0,0 @@ -[[counters]] -== Counters - -include::./counters_generated.adoc[] diff --git a/doc/manuals/chapters/counters_generated.adoc b/doc/manuals/chapters/counters_generated.adoc index dac46aa4..e16560ce 100644 --- a/doc/manuals/chapters/counters_generated.adoc +++ b/doc/manuals/chapters/counters_generated.adoc @@ -1,52 +1,10 @@ // autogenerated by show asciidoc counters -These counters and their description based on OsmoSGSN 1.4.0.31-05fe (OsmoSGSN). +These counters and their description are based on OsmoGbProxy UNKNOWN-dirty (OsmoGbProxy). === Rate Counters // generating tables for rate_ctr_group -// rate_ctr_group table BSSGP Peer Statistics -.bssgp:bss_ctx - BSSGP Peer Statistics -[options="header"] -|=== -| Name | Reference | Description -| packets:in | <> | Packets at BSSGP Level ( In) -| packets:out | <> | Packets at BSSGP Level (Out) -| bytes:in | <> | Bytes at BSSGP Level ( In) -| bytes:out | <> | Bytes at BSSGP Level (Out) -| blocked | <> | BVC Blocking count -| discarded | <> | BVC LLC Discarded count -| status | <> | BVC Status count -|=== -// rate_ctr_group table SGSN Overall Statistics -.sgsn - SGSN Overall Statistics -[options="header"] -|=== -| Name | Reference | Description -| llc:dl_bytes | <> | Count sent LLC bytes before giving it to the bssgp layer -| llc:ul_bytes | <> | Count successful received LLC bytes (encrypt & fcs correct) -| llc:dl_packets | <> | Count successful sent LLC packets before giving it to the bssgp layer -| llc:ul_packets | <> | Count successful received LLC packets (encrypt & fcs correct) -| gprs:attach_requested | <> | Received attach requests -| gprs:attach_accepted | <> | Sent attach accepts -| gprs:attach_rejected | <> | Sent attach rejects -| gprs:detach_requested | <> | Received detach requests -| gprs:detach_acked | <> | Sent detach acks -| gprs:routing_area_requested | <> | Received routing area requests -| gprs:routing_area_requested | <> | Sent routing area acks -| gprs:routing_area_requested | <> | Sent routing area rejects -| pdp:activate_requested | <> | Received activate requests -| pdp:activate_rejected | <> | Sent activate rejects -| pdp:activate_accepted | <> | Sent activate accepts -| pdp:request_activated | <> | unused -| pdp:request_activate_rejected | <> | unused -| pdp:modify_requested | <> | unused -| pdp:modify_accepted | <> | unused -| pdp:dl_deactivate_requested | <> | Sent deactivate requests -| pdp:dl_deactivate_accepted | <> | Sent deactivate accepted -| pdp:ul_deactivate_requested | <> | Received deactivate requests -| pdp:ul_deactivate_accepted | <> | Received deactivate accepts -|=== // rate_ctr_group table NSVC Peer Statistics .ns:nsvc - NSVC Peer Statistics [options="header"] @@ -54,16 +12,46 @@ These counters and their description based on OsmoSGSN 1.4.0.31-05fe (OsmoSGSN). | Name | Reference | Description | packets:in | <> | Packets at NS Level ( In) | packets:out | <> | Packets at NS Level (Out) +| packets:out:drop | <> | Dropped Packets (Out) | bytes:in | <> | Bytes at NS Level ( In) | bytes:out | <> | Bytes at NS Level (Out) -| blocked | <> | NS-VC Block count -| dead | <> | NS-VC gone dead count +| bytes:out:drop | <> | Dropped Bytes (Out) +| blocked | <> | NS-VC Block count +| unblocked | <> | NS-VC Unblock count +| dead | <> | NS-VC gone dead count | replaced | <> | NS-VC replaced other count -| nsei-chg | <> | NS-VC changed NSEI count -| inv-nsvci | <> | NS-VCI was invalid count -| inv-nsei | <> | NSEI was invalid count -| lost:alive | <> | ALIVE ACK missing count -| lost:reset | <> | RESET ACK missing count +| nsei-chg | <> | NS-VC changed NSEI count +| lost:alive | <> | ALIVE ACK missing count +| lost:reset | <> | RESET ACK missing count +|=== +// rate_ctr_group table GBProxy Peer Statistics +.gbproxy:peer - GBProxy Peer Statistics +[options="header"] +|=== +| Name | Reference | Description +| blocked | <> | BVC Block +| unblocked | <> | BVC Unblock +| dropped | <> | BVC blocked, dropped packet +| inv-nsei | <> | NSEI mismatch +| tx-err | <> | NS Transmission error +|=== +// rate_ctr_group table GBProxy Global Statistics +.gbproxy:global - GBProxy Global Statistics +[options="header"] +|=== +| Name | Reference | Description +| inv-bvci | <> | Invalid BVC Identifier +| inv-lai | <> | Invalid Location Area Identifier +| inv-rai | <> | Invalid Routing Area Identifier +| inv-nsei | <> | No BVC established for NSEI +| proto-err:bss | <> | BSSGP protocol error (BSS ) +| proto-err:sgsn | <> | BSSGP protocol error (SGSN) +| not-supp:bss | <> | Feature not supported (BSS ) +| not-supp:sgsn | <> | Feature not supported (SGSN) +| restart:sgsn | <> | Restarted RESET procedure (SGSN) +| tx-err:sgsn | <> | NS Transmission error (SGSN) +| error | <> | Other error +| mod-peer-err | <> | Patch error: no peer |=== == Osmo Stat Items @@ -76,6 +64,14 @@ NSVC Peer Statistics | Name | Reference | Description | Unit | alive.delay | <> | ALIVE response time | ms |=== +NS Bind Statistics +// osmo_stat_item_group table NS Bind Statistics +.ns.bind - NS Bind Statistics +[options="header"] +|=== +| Name | Reference | Description | Unit +| tx_backlog_length | <> | Transmit backlog length | packets +|=== == Osmo Counters // generating tables for osmo_counters diff --git a/doc/manuals/chapters/overview.adoc b/doc/manuals/chapters/overview.adoc deleted file mode 100644 index e2c01071..00000000 --- a/doc/manuals/chapters/overview.adoc +++ /dev/null @@ -1,109 +0,0 @@ -[[chapter_introduction]] -== Overview - -[[intro_overview]] -=== About OsmoSGSN - -OsmoSGSN is the Osmocom implementation of the GPRS SGSN (Serving Gprs -Support Node) element inside the GPRS network. The SGSN plays a similar -central function to the GPRS network as the MSC plays in the GSM -network. - -The SGSN is connected on the downlink side to Gb interfaces of the BSS, -specifically the PCU inside the BSS. The SGSN is further connected by -the GTP protocol to the GGSN which terminates the tunnels towards the -external packet data network (e.g. IPv4). - -OsmoSGSN supports both a PCU that is co-located with(in) the BTS, as -well as a PCU that is co-located with(in) the BSC. In combination with -OsmoNITB/OsmoBSC/OsmoBTS, the PCU is co-located within the BTS. - -[[fig-gprs-pcubts]] -.GPRS network architecture with PCU in BTS -[graphviz] ----- -digraph G { - rankdir=LR; - MS0 [label="MS"]; - MS1 [label="MS"]; - MS0->BTS [label="Um"]; - MS1->BTS [label="Um"]; - BTS->BSC [label="Abis"]; - BSC->MSC [label="A"]; - BTS->PCU [label="pcu_sock"]; - PCU->SGSN [label="Gb"]; - SGSN->GGSN [label="GTP"]; -} ----- - -=== Software Components - -OsmoSGSN contains a variety of different software components, which -we'll quickly describe in this section. - -==== Gb Implementation - -OsmoSGSN implements the ETSI/3GPP specified Gb interface, including TS -08.16 (NS), TS 08.18 (BSSGP) and TS 08.64 (LLC) protocols. As transport -layers for NS, it supports NS/IP (NS encapsulated in UDP/IP), as well as -NS/FR/GRE/IP. The latter is provided in order to use a Router with -Ethernet and Frame Relay interface to convert to actual physical Frame -Relay medium, which is not directly supported by OsmoSGSN. - -The actual Gb Implementation is part of the libosmogb library, which is -in turn part of the libosmocore software package. This allows the same -Gb implementation to be used from osmo-pcu, osmo-gbproxy as well as -OsmoSGSN. - - -==== GTP Implementation - -OsmoSGSN uses the libgtp implementation originating from OsmoGGSN. It -supports both GTPv0 and GTPv1. - - -==== GMM Implementation - -The GPRS Mobility Management implementation is quite simplistic at this -point. It supports the GPRS ATTACH and GPRS ROUTING AREA UPDATE -procedures, as well as GPRS ATTACH and GPRS DETACH. - -==== LLC Implementation - -The LLC (Logical Link Control) implementation of OsmoSGSN only supports -non-acknowledged mode, as this is the most common use case in real-world -GPRS networks. - -It does support both TCP/IP header compression according to RFC1144 and -payload compression according to V.42bis - -The LLC implementation does support LLC encryption with ciphers GEA3 and GEA4. -For encryption to work the auth policy needs to be set to remote and the SGSN -connected to an HLR containing the subscriber data including key material. -Other auth policys will not work with encryption. - -==== Session Management Implementation - -The session management procedures ACTIVATE PDP CONTEXT and DEACTIVATE -PDP CONTEXT are supported. However, no MODIFY PDP CONTEXT and no -Network-initiated PDP context activation is possible. This is again -covering the predominant use cases and configurations in GPRS real-world -networks while skipping the more esoteric features. - -Multiple PDP contexts can be attached by a single MS. - -Multiple GGSNs can be configured and routing to a GGSN can be configured based -on APN. Dynamic lookup of GGSNs though DNS-based APN resolving is also possible. - -=== Limitations - -At the time of writing, OsmoSGSN still has a number of limitations, -which are a result of the demand-driven Open Source development model. -If you require any of those features, please consider implementing and -contributing them, or contracting the existing OsmoSGSN developers for -performing that work. - -Known Limitations include: - -* No paging coordination between SGSN and MSC -* No SMS over Ps support diff --git a/doc/manuals/chapters/running.adoc b/doc/manuals/chapters/running.adoc deleted file mode 100644 index 63c2b278..00000000 --- a/doc/manuals/chapters/running.adoc +++ /dev/null @@ -1,35 +0,0 @@ -== Running OsmoSGSN - -The OsmoSGSN executable (`osmo-sgsn`) offers the following command-line -options: - - -=== SYNOPSIS - -*osmo-sgsn* [-h|-V] [-d 'DBGMASK'] [-D] [-c 'CONFIGFILE'] [-s] [-e 'LOGLEVEL'] - - -=== OPTIONS - -*-h, --help*:: - Print a short help message about the supported options -*-V, --version*:: - Print the compile-time version number of the OsmoSGSN program -*-d, --debug 'DBGMASK','DBGLEVELS'*:: - Set the log subsystems and levels for logging to stderr. This - has mostly been superseded by VTY-based logging configuration, - see <> for further information. -*-D, --daemonize*:: - Fork the process as a daemon into background. -*-c, --config-file 'CONFIGFILE'*:: - Specify the file and path name of the configuration file to be - used. If none is specified, use `osmo_sgsn.cfg` in the current - working directory. -*-s, --disable-color*:: - Disable colors for logging to stderr. This has mostly been - deprecated by VTY based logging configuration, see <> - for more information. -*-e, --log-level 'LOGLEVEL'*:: - Set the global log level for logging to stderr. This has mostly - been deprecated by VTY based logging configuration, see - <> for more information. diff --git a/doc/manuals/osmogbproxy-usermanual.adoc b/doc/manuals/osmogbproxy-usermanual.adoc index d19bdd4a..f4da954a 100644 --- a/doc/manuals/osmogbproxy-usermanual.adoc +++ b/doc/manuals/osmogbproxy-usermanual.adoc @@ -25,7 +25,7 @@ include::./common/chapters/gb.adoc[] include::./common/chapters/control_if.adoc[] -//include::{srcdir}/chapters/counters.adoc[] +include::{srcdir}/chapters/counters_generated.adoc[] include::./common/chapters/port_numbers.adoc[] diff --git a/doc/manuals/osmogbproxy-vty-reference.xml b/doc/manuals/osmogbproxy-vty-reference.xml index ecf22680..5c2a16a8 100644 --- a/doc/manuals/osmogbproxy-vty-reference.xml +++ b/doc/manuals/osmogbproxy-vty-reference.xml @@ -6,7 +6,7 @@ - + ]> diff --git a/doc/manuals/osmosgsn-usermanual-docinfo.xml b/doc/manuals/osmosgsn-usermanual-docinfo.xml deleted file mode 100644 index afbf1094..00000000 --- a/doc/manuals/osmosgsn-usermanual-docinfo.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - 1 - January 13, 2013 - HW - - Initial version. - - - - 2 - February 2016 - HW - - Conversion to asciidoc, removal of sysmoBTS specific parts. - - - - - - - Harald - Welte - hwelte@sysmocom.de - HW - - sysmocom - sysmocom - s.f.m.c. GmbH - Managing Director - - - - - - 2013-2016 - sysmocom - s.f.m.c. GmbH - - - - - Permission is granted to copy, distribute and/or modify this - document under the terms of the GNU Free Documentation License, - Version 1.3 or any later version published by the Free Software - Foundation; with no Invariant Sections, no Front-Cover Texts, - and no Back-Cover Texts. A copy of the license is included in - the section entitled "GNU Free Documentation License". - - - The Asciidoc source code of this manual can be found at - - http://git.osmocom.org/osmo-gsm-manuals/ - - - diff --git a/doc/manuals/osmosgsn-usermanual.adoc b/doc/manuals/osmosgsn-usermanual.adoc deleted file mode 100644 index 610704ae..00000000 --- a/doc/manuals/osmosgsn-usermanual.adoc +++ /dev/null @@ -1,40 +0,0 @@ -:gfdl-enabled: - -OsmoSGSN User Manual -==================== -Harald Welte - - -include::./common/chapters/preface.adoc[] - -include::{srcdir}/chapters/overview.adoc[] - -include::{srcdir}/chapters/running.adoc[] - -include::{srcdir}/chapters/control.adoc[] - -include::./common/chapters/vty.adoc[] - -include::./common/chapters/logging.adoc[] - -include::{srcdir}/chapters/configuration.adoc[] - -include::./common/chapters/cs7-config.adoc[] - -include::./common/chapters/gb.adoc[] - -include::./common/chapters/control_if.adoc[] - -include::./common/chapters/oap.adoc[] - -include::./common/chapters/gsup.adoc[] - -include::{srcdir}/chapters/counters.adoc[] - -include::./common/chapters/port_numbers.adoc[] - -include::./common/chapters/bibliography.adoc[] - -include::./common/chapters/glossary.adoc[] - -include::./common/chapters/gfdl.adoc[] diff --git a/doc/manuals/osmosgsn-vty-reference.xml b/doc/manuals/osmosgsn-vty-reference.xml deleted file mode 100644 index 82b666a0..00000000 --- a/doc/manuals/osmosgsn-vty-reference.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - -]> - - - - - - v1 - 13th January 2013 - hw - Initial - - - v2 - 5th March 2014 - hf - Update to match osmo-bsc version 0.13.0-305 - - - - OsmoSGSN VTY Reference - - - 2013-2014 - - - - This work is copyright by sysmocom - s.f.m.c. GmbH. All rights reserved. - - - - - - &chapter-vty; - - diff --git a/doc/manuals/regen_doc.sh b/doc/manuals/regen_doc.sh index 847b764a..e68e7e58 100755 --- a/doc/manuals/regen_doc.sh +++ b/doc/manuals/regen_doc.sh @@ -51,27 +51,24 @@ interact_vty() { } DIR="$(cd "$(dirname "$0")"; pwd)" +echo $DIR cd "$DIR" require_osmo_interact_vty interact_vty \ "update_vty_reference" \ - "vty/sgsn_vty_reference.xml" \ - 4245 \ - osmo-sgsn -c "../examples/osmo-sgsn/osmo-sgsn.cfg" - -interact_vty \ - "update_vty_reference" \ - "vty-osmogbproxy/gbproxy_vty_reference.xml" \ + "vty/gbproxy_vty_reference.xml" \ 4246 \ osmo-gbproxy -c "../examples/osmo-gbproxy/osmo-gbproxy.cfg" +sleep 5 + interact_vty \ "update_counters" \ "chapters/counters_generated.adoc" \ - 4245 \ - osmo-sgsn -c "../examples/osmo-sgsn/osmo-sgsn.cfg" + 4246 \ + osmo-gbproxy -c "../examples/osmo-gbproxy/osmo-gbproxy.cfg" echo "Done with all" diff --git a/doc/manuals/vty-osmogbproxy/gbproxy_vty_additions.xml b/doc/manuals/vty/gbproxy_vty_additions.xml similarity index 100% rename from doc/manuals/vty-osmogbproxy/gbproxy_vty_additions.xml rename to doc/manuals/vty/gbproxy_vty_additions.xml diff --git a/doc/manuals/vty-osmogbproxy/gbproxy_vty_reference.xml b/doc/manuals/vty/gbproxy_vty_reference.xml similarity index 78% rename from doc/manuals/vty-osmogbproxy/gbproxy_vty_reference.xml rename to doc/manuals/vty/gbproxy_vty_reference.xml index 1db3c0d2..19b04e1f 100644 --- a/doc/manuals/vty-osmogbproxy/gbproxy_vty_reference.xml +++ b/doc/manuals/vty/gbproxy_vty_reference.xml @@ -7,9 +7,25 @@ - + + + + + + + + + + + + + + + + + @@ -67,9 +83,10 @@ - + + @@ -188,13 +205,13 @@ - + - + @@ -214,6 +231,8 @@ + + @@ -253,12 +272,12 @@ - + - + @@ -278,6 +297,8 @@ + + @@ -365,10 +386,49 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -379,43 +439,41 @@ - + - + + - + - - + + - + - - + + - + - - - - - + + + - + - - - + + @@ -587,13 +645,13 @@ - + - + @@ -613,6 +671,8 @@ + + @@ -652,12 +712,12 @@ - + - + @@ -677,6 +737,8 @@ + + @@ -764,10 +826,61 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -778,17 +891,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + @@ -796,75 +947,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - config @@ -1052,6 +1134,20 @@ + + + + + + + + + + + + + + @@ -1089,11 +1185,11 @@ - + - + @@ -1101,9 +1197,11 @@ - + - + + + @@ -1181,13 +1279,13 @@ - + - + @@ -1207,6 +1305,8 @@ + + @@ -1246,16 +1346,6 @@ - - - - - - - - - - config-stats @@ -1325,6 +1415,12 @@ + + + + + + config-line @@ -1347,280 +1443,95 @@ - - config-ns - + + config-gbproxy + - - - - + + + - + + + + - - - - + + + - + + + + - - - - + + + + + - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - - config-gbproxy - + + config-sgsn + - - - + + - + + + + - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - + - + + + + - - + + + + - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + diff --git a/doc/manuals/vty/sgsn_vty_additions.xml b/doc/manuals/vty/sgsn_vty_additions.xml deleted file mode 100644 index 660b695f..00000000 --- a/doc/manuals/vty/sgsn_vty_additions.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - Configure the remote GGSN, access-control and other - attributes of the SGSN - - diff --git a/doc/manuals/vty/sgsn_vty_reference.xml b/doc/manuals/vty/sgsn_vty_reference.xml deleted file mode 100644 index 8ffc607b..00000000 --- a/doc/manuals/vty/sgsn_vty_reference.xml +++ /dev/null @@ -1,2677 +0,0 @@ - - - Common Commands - These commands are available on all VTY nodes. They are listed here only once, to unclutter the VTY reference. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - view - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enable - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - config - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - config-log - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - config-stats - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - config-line - - - - - - - - - - - - - - - - - - - - - config-ns - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - config-bssgp - - - config-ctrl - - - - - - - - - config-cs7 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - config-cs7-as - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - config-cs7-asp - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - config-cs7-sccpaddr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - config-cs7-sccpaddr-gt - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - config-cpu-sched - - - - - - - - - - - - - - - - - - - - - config-sgsn - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/osmoappdesc.py b/osmoappdesc.py index 1fccafd7..7f60840b 100644 --- a/osmoappdesc.py +++ b/osmoappdesc.py @@ -17,17 +17,13 @@ app_configs = { "gbproxy": ["doc/examples/osmo-gbproxy/osmo-gbproxy.cfg"], - "sgsn": ["doc/examples/osmo-sgsn/osmo-sgsn.cfg"], - "gtphub": ["doc/examples/osmo-gtphub/osmo-gtphub-1iface.cfg"] } -apps = [(4246, "src/gbproxy/osmo-gbproxy", "OsmoGbProxy", "gbproxy"), - (4245, "src/sgsn/osmo-sgsn", "OsmoSGSN", "sgsn"), - (4253, "src/gtphub/osmo-gtphub", "OsmoGTPhub", "gtphub") +apps = [(4246, "src/osmo-gbproxy", "OsmoGbProxy", "gbproxy"), ] -vty_command = ["./src/sgsn/osmo-sgsn", "-c", - "doc/examples/osmo-sgsn/osmo-sgsn.cfg"] +vty_command = ["./src/osmo-gbproxy", "-c", + "doc/examples/osmo-gbproxy/osmo-gbproxy.cfg"] -vty_app = apps[1] +vty_app = apps[0] diff --git a/src/gb_proxy_main.c b/src/gb_proxy_main.c index 7c6f1d2c..2e9ff79d 100644 --- a/src/gb_proxy_main.c +++ b/src/gb_proxy_main.c @@ -131,12 +131,42 @@ static void print_help() printf(" -T --timestamp Prefix every log line with a timestamp\n"); printf(" -V --version. Print the version.\n"); printf(" -e --log-level number. Set a global loglevel.\n"); + + printf("\nVTY reference generation:\n"); + printf(" --vty-ref-mode MODE VTY reference generation mode (e.g. 'expert').\n"); + printf(" --vty-ref-xml Generate the VTY reference XML output and exit.\n"); +} + +static void handle_long_options(const char *prog_name, const int long_option) +{ + static int vty_ref_mode = VTY_REF_GEN_MODE_DEFAULT; + + switch (long_option) { + case 1: + vty_ref_mode = get_string_value(vty_ref_gen_mode_names, optarg); + if (vty_ref_mode < 0) { + fprintf(stderr, "%s: Unknown VTY reference generation " + "mode '%s'\n", prog_name, optarg); + exit(2); + } + break; + case 2: + fprintf(stderr, "Generating the VTY reference in mode '%s' (%s)\n", + get_value_string(vty_ref_gen_mode_names, vty_ref_mode), + get_value_string(vty_ref_gen_mode_desc, vty_ref_mode)); + vty_dump_xml_ref_mode(stdout, (enum vty_ref_gen_mode) vty_ref_mode); + exit(0); + default: + fprintf(stderr, "%s: error parsing cmdline options\n", prog_name); + exit(2); + } } static void handle_options(int argc, char **argv) { while (1) { int option_index = 0, c; + static int long_option = 0; static struct option long_options[] = { { "help", 0, 0, 'h' }, { "debug", 1, 0, 'd' }, @@ -146,6 +176,8 @@ static void handle_options(int argc, char **argv) { "timestamp", 0, 0, 'T' }, { "version", 0, 0, 'V' }, { "log-level", 1, 0, 'e' }, + { "vty-ref-mode", 1, &long_option, 1 }, + { "vty-ref-xml", 0, &long_option, 2 }, { 0, 0, 0, 0 } }; @@ -159,6 +191,9 @@ static void handle_options(int argc, char **argv) print_usage(); print_help(); exit(0); + case 0: + handle_long_options(argv[0], long_option); + break; case 's': log_set_use_color(osmo_stderr_target, 0); break; diff --git a/tests/Makefile.am b/tests/Makefile.am index b0e2a74f..48d65790 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -56,11 +56,11 @@ vty-python-test: $(BUILT_SOURCES) vty-transcript-test: osmo_verify_transcript_vty.py -v \ -n OsmoGbProxy -p 4246 \ - -r "$(top_builddir)/src/gbproxy/osmo-gbproxy -c $(top_srcdir)/doc/examples/osmo-gbproxy/osmo-gbproxy.cfg" \ + -r "$(top_builddir)/src/osmo-gbproxy -c $(top_srcdir)/doc/examples/osmo-gbproxy/osmo-gbproxy.cfg" \ $(U) $${T:-$(srcdir)/osmo-gbproxy_test-nodes.vty} osmo_verify_transcript_vty.py -v \ -n OsmoGbProxy -p 4246 \ - -r "$(top_builddir)/src/gbproxy/osmo-gbproxy -c $(top_srcdir)/doc/examples/osmo-gbproxy/osmo-gbproxy-pool.cfg" \ + -r "$(top_builddir)/src/osmo-gbproxy -c $(top_srcdir)/doc/examples/osmo-gbproxy/osmo-gbproxy-pool.cfg" \ $(U) $${T:-$(srcdir)/osmo-gbproxy-pool_test-nodes.vty} rm -f $(builddir)/sms.db $(builddir)/gsn_restart diff --git a/tests/vty_test_runner.py b/tests/vty_test_runner.py index 92466bb0..50cf4f3b 100755 --- a/tests/vty_test_runner.py +++ b/tests/vty_test_runner.py @@ -71,11 +71,11 @@ class TestVTYBase(unittest.TestCase): class TestVTYGbproxy(TestVTYBase): def vty_command(self): - return ["./src/gbproxy/osmo-gbproxy", "-c", + return ["./src/osmo-gbproxy", "-c", "doc/examples/osmo-gbproxy/osmo-gbproxy.cfg"] def vty_app(self): - return (4246, "./src/gbproxy/osmo-gbproxy", "OsmoGbProxy", "gbproxy") + return (4246, "./src/osmo-gbproxy", "OsmoGbProxy", "gbproxy") def testVtyTree(self): self.vty.enable() @@ -114,180 +114,11 @@ class TestVTYGbproxy(TestVTYBase): self.assertTrue(res.find('Deleted 0 BVC') >= 0) self.assertTrue(res.find('NSEI not found') >= 0) -class TestVTYSGSN(TestVTYBase): - - def vty_command(self): - return ["./src/sgsn/osmo-sgsn", "-c", - "doc/examples/osmo-sgsn/osmo-sgsn-accept-all.cfg"] - - def vty_app(self): - return (4245, "./src/sgsn/osmo-sgsn", "OsmoSGSN", "sgsn") - - def testVtyTree(self): - self.vty.enable() - self.assertTrue(self.vty.verify('configure terminal', [''])) - self.assertEqual(self.vty.node(), 'config') - self.checkForEndAndExit() - self.assertTrue(self.vty.verify('ns', [''])) - self.assertEqual(self.vty.node(), 'config-ns') - self.checkForEndAndExit() - self.assertTrue(self.vty.verify('exit', [''])) - self.assertEqual(self.vty.node(), 'config') - self.assertTrue(self.vty.verify('sgsn', [''])) - self.assertEqual(self.vty.node(), 'config-sgsn') - self.checkForEndAndExit() - self.assertTrue(self.vty.verify('exit', [''])) - self.assertEqual(self.vty.node(), 'config') - - def testVtyShow(self): - res = self.vty.command("show ns") - self.assertTrue(res.find('0 NS-VC:') >= 0) - self.assertTrue(self.vty.verify('show bssgp', [''])) - self.assertTrue(self.vty.verify('show bssgp stats', [''])) - self.assertTrue(self.vty.verify('show bssgp nsei 123', [''])) - self.assertTrue(self.vty.verify('show bssgp nsei 123 stats', [''])) - self.assertTrue(self.vty.verify('show sgsn', [' GSN: signalling 127.0.0.1, user traffic 127.0.0.1'])) - self.assertTrue(self.vty.verify('show mm-context all', [''])) - self.assertTrue(self.vty.verify('show mm-context imsi 000001234567', ['No MM context for IMSI 000001234567'])) - self.assertTrue(self.vty.verify('show pdp-context all', [''])) - - res = self.vty.command("show sndcp") - self.assertTrue(res.find('State of SNDCP Entities') >= 0) - - res = self.vty.command("show llc") - self.assertTrue(res.find('State of LLC Entities') >= 0) - - def testVtyAuth(self): - self.vty.enable() - self.assertTrue(self.vty.verify('configure terminal', [''])) - self.assertEqual(self.vty.node(), 'config') - self.assertTrue(self.vty.verify('sgsn', [''])) - self.assertEqual(self.vty.node(), 'config-sgsn') - self.assertTrue(self.vty.verify('auth-policy accept-all', [''])) - res = self.vty.command("show running-config") - self.assertTrue(res.find('auth-policy accept-all') > 0) - self.assertTrue(self.vty.verify('auth-policy acl-only', [''])) - res = self.vty.command("show running-config") - self.assertTrue(res.find('auth-policy acl-only') > 0) - self.assertTrue(self.vty.verify('auth-policy closed', [''])) - res = self.vty.command("show running-config") - self.assertTrue(res.find('auth-policy closed') > 0) - self.assertTrue(self.vty.verify('gsup remote-ip 127.0.0.4', [''])) - self.assertTrue(self.vty.verify('gsup remote-port 2222', [''])) - self.assertTrue(self.vty.verify('auth-policy remote', [''])) - res = self.vty.command("show running-config") - self.assertTrue(res.find('auth-policy remote') > 0) - - def testVtySubscriber(self): - self.vty.enable() - res = self.vty.command('show subscriber cache') - self.assertTrue(res.find('1234567890') < 0) - self.assertTrue(self.vty.verify('update-subscriber imsi 1234567890 create', [''])) - res = self.vty.command('show subscriber cache') - self.assertTrue(res.find('1234567890') >= 0) - self.assertTrue(res.find('Authorized: 0') >= 0) - self.assertTrue(self.vty.verify('update-subscriber imsi 1234567890 update-location-result ok', [''])) - res = self.vty.command('show subscriber cache') - self.assertTrue(res.find('1234567890') >= 0) - self.assertTrue(res.find('Authorized: 1') >= 0) - self.assertTrue(self.vty.verify('update-subscriber imsi 1234567890 cancel update-procedure', [''])) - res = self.vty.command('show subscriber cache') - self.assertTrue(res.find('1234567890') >= 0) - self.assertTrue(self.vty.verify('update-subscriber imsi 1234567890 destroy', [''])) - res = self.vty.command('show subscriber cache') - self.assertTrue(res.find('1234567890') < 0) - - def testVtyGgsn(self): - self.vty.enable() - self.assertTrue(self.vty.verify('configure terminal', [''])) - self.assertEqual(self.vty.node(), 'config') - self.assertTrue(self.vty.verify('sgsn', [''])) - self.assertEqual(self.vty.node(), 'config-sgsn') - self.assertTrue(self.vty.verify('ggsn 0 remote-ip 127.99.99.99', [''])) - self.assertTrue(self.vty.verify('ggsn 0 gtp-version 1', [''])) - self.assertTrue(self.vty.verify('apn * ggsn 0', [''])) - self.assertTrue(self.vty.verify('apn apn1.test ggsn 0', [''])) - self.assertTrue(self.vty.verify('apn apn1.test ggsn 1', ['% a GGSN with id 1 has not been defined'])) - self.assertTrue(self.vty.verify('apn apn1.test imsi-prefix 123456 ggsn 0', [''])) - self.assertTrue(self.vty.verify('apn apn2.test imsi-prefix 123456 ggsn 0', [''])) - res = self.vty.command("show running-config") - self.assertTrue(res.find('ggsn 0 remote-ip 127.99.99.99') >= 0) - self.assertTrue(res.find('ggsn 0 gtp-version 1') >= 0) - self.assertTrue(res.find('apn * ggsn 0') >= 0) - self.assertTrue(res.find('apn apn1.test ggsn 0') >= 0) - self.assertTrue(res.find('apn apn1.test imsi-prefix 123456 ggsn 0') >= 0) - self.assertTrue(res.find('apn apn2.test imsi-prefix 123456 ggsn 0') >= 0) - - def testVtyEasyAPN(self): - self.vty.enable() - self.assertTrue(self.vty.verify('configure terminal', [''])) - self.assertEqual(self.vty.node(), 'config') - self.assertTrue(self.vty.verify('sgsn', [''])) - self.assertEqual(self.vty.node(), 'config-sgsn') - - res = self.vty.command("show running-config") - self.assertEqual(res.find("apn internet"), -1) - - self.assertTrue(self.vty.verify("access-point-name internet.apn", [''])) - res = self.vty.command("show running-config") - self.assertTrue(res.find("apn internet.apn ggsn 0") >= 0) - - self.assertTrue(self.vty.verify("no access-point-name internet.apn", [''])) - res = self.vty.command("show running-config") - self.assertEqual(res.find("apn internet"), -1) - - def testVtyCDR(self): - self.vty.enable() - self.assertTrue(self.vty.verify('configure terminal', [''])) - self.assertEqual(self.vty.node(), 'config') - self.assertTrue(self.vty.verify('sgsn', [''])) - self.assertEqual(self.vty.node(), 'config-sgsn') - - res = self.vty.command("show running-config") - self.assertTrue(res.find("no cdr filename") > 0) - - self.vty.command("cdr filename bla.cdr") - res = self.vty.command("show running-config") - self.assertEqual(res.find("no cdr filename"), -1) - self.assertTrue(res.find(" cdr filename bla.cdr") > 0) - - self.vty.command("no cdr filename") - res = self.vty.command("show running-config") - self.assertTrue(res.find("no cdr filename") > 0) - self.assertEqual(res.find(" cdr filename bla.cdr"), -1) - - res = self.vty.command("show running-config") - self.assertTrue(res.find(" cdr interval 600") > 0) - - self.vty.command("cdr interval 900") - res = self.vty.command("show running-config") - self.assertTrue(res.find(" cdr interval 900") > 0) - self.assertEqual(res.find(" cdr interval 600"), -1) - - def testVtyTimers(self): - self.vty.enable() - self.assertTrue(self.vty.verify('configure terminal', [''])) - self.assertEqual(self.vty.node(), 'config') - self.assertTrue(self.vty.verify('sgsn', [''])) - self.assertEqual(self.vty.node(), 'config-sgsn') - - for t in [3312, 3322, 3350, 3360, 3370, 3313, 3314, 3316, 3385, 3395, 3397]: - self.assertTrue(self.vty.verify('timer t%d 10' % t, [''])) - def add_gbproxy_test(suite, workdir): - if not os.path.isfile(os.path.join(workdir, "src/gbproxy/osmo-gbproxy")): - print("Skipping the Gb-Proxy test") - return + assert os.path.isfile(os.path.join(workdir, "src/osmo-gbproxy")) test = unittest.TestLoader().loadTestsFromTestCase(TestVTYGbproxy) suite.addTest(test) -def add_sgsn_test(suite, workdir): - if not os.path.isfile(os.path.join(workdir, "src/sgsn/osmo-sgsn")): - print("Skipping the SGSN test") - return - test = unittest.TestLoader().loadTestsFromTestCase(TestVTYSGSN) - suite.addTest(test) - if __name__ == '__main__': import argparse import sys @@ -319,7 +150,6 @@ if __name__ == '__main__': print("Running tests for specific VTY commands") suite = unittest.TestSuite() add_gbproxy_test(suite, workdir) - add_sgsn_test(suite, workdir) if args.test_name: osmoutil.pick_tests(suite, *args.test_name)