blob: 721f5ad37acd189240decd8320da16e509a2c154 [file] [log] [blame]
Steve McIntyre7f149342015-08-06 15:08:27 +01001Port numbering and naming in VLANd
2==================================
3
4This is a far more complex subject than it should be, and it may cause
5problems for end users depending on their usage models. This is
6particularly likely for those users with Cisco Catalyst 3750 switches
7configured with extra internal modules for extra copper/fibre ports.
8
9Terminology
10===========
11
12For consistency, throughout this document and within VLANd two terms
13are used to identify switch ports:
14
15 * a PORT NAME is the (typically) alphanumeric identifier for a switch
16 port *in software*, i.e. when using the CLI to manage a
17 switch. Common naming styles vary significantly here; examples from
18 the VLANd test rack in Linaro's lab include "Gi1/0/6", "Gi1/1/4",
19 "Te1/1/2", "fa24", "gi3", "1/0/23"
20
21 * a PORT NUMBER is the (typically) numeric identifier for a switch
22 port that is labelled visibly on the switch somewhere, typically
23 next to the port or a group of ports. Not all switches limit
24 themselves to numeric labels, though. The same examples from our
25 test rack are described as "6", "G4/Te2", "24", "G3", "23G", "23T"
26
27These example include some of the problems - try and match tnem up!
28
29The problem
30===========
31
32On all of the switch models that we currently support, there is a
33disconnect between the port names and the associated port numbers. The
34port names are not directly shown to the user on any of our switches,
35which is not a good start.
36
37To a human operator, it is likely not very difficult to perform the
38mapping from one scheme to the other in most cases. However, multiple
39cases exist where it is difficult to map reliably from one identifier
40to the other in software without needing extensive manual
41configuration. For our VLAN control to be useful, we need to be able
42to identify ports in a recognisable way for our users who have
43connected devices to their network.
44
45In the examples above, I showed 6 identifiers in each list but they
46only correspond to 5 physical ports on the switches!
47
48Problem 1: Disjoint port numbers
49--------------------------------
50
51On our Cisco SF300, there are two sets of ports: 48 10/100M RJ45 ports
52and a further four 1G RJ45 ports. They're labelled externally as ports
531-48 and G1-G4; internally the names are fa1-fa48 and
54gi1-gi4. Thankfully, this particular case isn't too hard to deal
55with. The SG300 we have (which works with the same driver) simply has
5652 ports labelled 1-52 and named gi1-gi52.
57
58Problem 2: Single physical ports with multiple possible port names
59------------------------------------------------------------------
60
61On our Cisco Catalyst 3750-X 24P, most of this is easy. It has 24 1G
62ports, labelled 1 to 24 on the front panel. The port name "Gi/1/0/6"
63corresponds to "6". However, we also have an extra SFP module fitted
64that exposes 4 extra 1G interfaces (labelled G1 to G4). However,
65there's more complication yet: G2 and G4 are dual-personality ports
66and can also work as 10G ports when appropriate SFP+ modules are
67inserted. These 1G and 10G ports are named differently in software
68depending on which speed is in use:
69
70 G1 -> Gi1/1/1
71 G2/Te1 -> Gi1/1/2 OR Te1/1/1
72 G3 -> Gi1/1/3
73 G4/Te2 -> Gi1/1/4 OR Te1/1/2
74
75Our Catalyst 3750 also has an extra 10/100M port on the back as a
76management port; VLANd explicitly ignores this port. Various other
77models in the 3750 range can come in a whole range of different
78configurations with 10/100M, 1G and 10G ports and it's very difficult
79to identify naming and numbering schemes for all of these without
80physical access to all of them.
81
82Problem 3: Multiple physical ports which map to the same port name
83------------------------------------------------------------------
84
85Our Netgear M7300-24XF (aka XSM7224S) has 24 10G SFP+ ports and a
86further 4 10G RJ45 ports. Those 4 copper ports replace the last 4 of
87the SFP+ ports in a "combo" arrengement - if an SFP module is
88inserted, the RJ45 port is disabled. Thus, on this switch we have the
89following port numbers and port names:
90
91 1 -> 1/0/1
92 ...
93 20 -> 1/0/2
94 21F/21T -> 1/0/21
95 ...
96 24F/24T -> 1/0/24
97
98This combo approach is also used on the TP-Link TL-SG2216; it has 16
991G RJ45 ports and 2 1G SFP ports which over-ride them:
100
101 1 -> Gi1/0/1
102 ...
103 14 -> Gi1/0/14
104 15/15F -> Gi1/0/15
105 16/16F -> Gi1/0/16
106
107These show the opposite problem to the Catalyst 3750 - if a user
108connects to port 16 on the TP-Link, that at least will show up as one
109consistent name in the CLI. However, should we be looking for port
110number 16 or 16F when talking to the user?
111
112A (partial) solution in VLANd 0.4 onwards
113=========================================
114
115Hopefully the above descriptions will make it clear that this is a
116hard problem to solve 100% reliably. However, it's a problem that must
117at least partially be solved as end-users supplying port numbers
118cannot be expected to know the port names that are used internally by
119the switches but not exposed externally. Yet port names must be used
120internally for all the interactions with the switches directly - this
121is the only way that the software can work.
122
123So, port numbers have been added as an extra column in the port
124database. New APIs and methods have been added to do lookups by port
125number as alternatives to lookups by port name, to make things easier
126for end users. When adding ports using the admin interface, a port
127number is now required too.
128
129The backend of the auto_import_switch admin command (the recommended
130way to add switches) will attempt to automatically allocate sensible
131port numbers as it probes switches and finds new ports. The algorithm
132chosen here for assigning port numbers is the simplest one that might
133work for most of the switches and configurations that we
134have. *Numeric* port numbers (i.e. without any prefix or suffix
135letters) will be assigned to port names simply in the order that the
136port names are listed via a switch's CLI, starting with "1". For
137almost all our supported switches, this should make sense for a user
138when trying to supply port numbers. However, *BE AWARE* of the
139possbility that your port numbers may not always match the port
140numbers written on your switch in some cases (e.g. the Cisco Catalyst
1413750 as described above).
142
143If this port number to port name mapping algorithm proves not to be
144sufficient, future releases of VLANd may include options in the config
145file to provide exact mappings. We'd prefer not to have to do this due
146to the admin overhead it will impose (and the attendant possibility of
147errors).