+
+std::string port_name(unsigned distro, unsigned portnum)
+{
+ char buf[16];
+
+ if (distro == 0) {
+ if (portnum < 23) {
+ sprintf(buf, "d01-1 g0/%u", portnum);
+ } else {
+ sprintf(buf, "d01-2 g0/%u", portnum - 22);
+ }
+ } else if (distro == 1) {
+ sprintf(buf, "d02 g1/0/%u", portnum);
+ } else if (distro == 2) {
+ sprintf(buf, "d03 g1/%u", portnum);
+ } else if (distro == 3) {
+ sprintf(buf, "d04 g1/0/%u", portnum);
+ } else if (distro == 4) {
+ if (portnum < 23) {
+ sprintf(buf, "d05-1 g0/%u", portnum);
+ } else {
+ sprintf(buf, "d05-2 g0/%u", portnum - 22);
+ }
+ } else {
+ sprintf(buf, "d%02u 1/0/%u", distro + 1, portnum);
+ }
+
+ return buf;
+}