Matt,

I can see that you currently have a way of enumerating peers for the beta web page e.g. if I look at:

https://beta.peeringdb.com/ix/132

I can see there are 31 "Peers at this Exchange Point" (which of course is those who have bothered to add themselves to Peering DB)

I've got a routine that looks like this:

def get_ixpParticpantCounts():
    netixData = json.loads(pdb_getsrc("netix"))["data"]
    participants = dict()
    for netix in netixData:
        for key, value in netix.iteritems():
            if key == 'ixlan':
                if value in participants:
                    participants[value] += 1
                else:
                    participants[value] = 1
    return participants

This gives me a dict() that looks like:

{1: 596, 2: 760, 3: 109, 4: 49, 5: 300, 6: 15, 7: 35, 8: 141, 9: 646, 10: 24, 11: 19, 12: 30, 13: 226, 14: 68, 15: 106, 16: 24, 17: 49, 18: 205, 19: 51, 20: 58, 21: 54, 22: 43, 23: 50, 24: 11, 25: 8, 26: 14, 27: 282, 28: 14, 29: 48, 30: 52, 31: 53, 32: 85, 33: 16, 34: 148, 35: 91, 36: 38, 37: 23, 38: 224, 39: 29, 40: 258, 41: 101, 42: 126, 43: 118, 44: 9, 45: 12, 46: 31, 47: 46, 48: 11, 49: 10, 50: 58, 51: 224, 52: 16, 53: 26, 54: 510, 55: 110, 56: 3, 57: 66, 58: 5, 59: 10, 60: 109, 61: 2, 62: 14, 63: 34, 64: 27, 65: 17, 66: 267, 67: 4, 68: 4, 69: 31, 70: 1, 71: 10, 72: 1, 73: 25, 74: 66, 75: 31, 76: 4, 77: 8, 78: 6, 80: 16, 81: 7, 82: 60, 83: 5, 84: 24, 86: 52, 87: 1, 88: 56, 89: 3, 90: 3, 91: 11, 92: 8, 93: 16, 94: 43, 95: 20, 96: 3, 97: 10, 98: 1, 99: 16, 100: 18, 101: 52, 102: 8, 103: 212, 104: 40, 105: 2, 106: 12, 107: 14, 108: 9, 109: 22, 110: 24, 111: 60, 112: 9, 113: 4, 114: 31, 115: 25, 116: 1, 117: 33, 118: 157, 119: 12, 120: 8, 121: 35, 122: 83, 123: 12, 124: 2, 125: 245, 126: 12, 127: 27, 128: 12, 129: 21, 130: 19, 131: 40, 132: 19, 133: 57, 134: 54, 135: 17, 136: 3, 137: 135, 138: 12, 139: 20, 140: 7, 141: 2, 142: 8, 143: 3, 145: 2, 146: 5, 147: 124, 148: 74, 149: 183, 150: 67, 151: 70, 152: 13, 153: 4, 154: 4, 156: 12, 157: 7, 158: 3, 159: 1, 160: 2, 161: 1, 162: 15, 163: 56, 165: 2, 166: 6, 167: 1, 169: 3, 170: 1, 171: 27, 172: 1, 173: 17, 174: 47, 175: 7, 176: 4, 178: 7, 180: 11, 181: 73, 182: 33, 183: 9, 185: 1, 186: 12, 187: 4, 188: 64, 189: 8, 190: 10, 191: 154, 192: 90, 193: 102, 194: 171, 195: 126, 196: 25, 197: 11, 198: 3, 199: 4, 200: 6, 201: 7, 202: 128, 203: 37, 204: 2, 205: 28, 206: 2, 207: 1, 208: 6, 209: 51, 210: 30, 211: 14, 212: 11, 213: 31, 214: 14, 215: 32, 217: 11, 219: 9, 220: 3, 221: 5, 222: 4, 223: 1, 224: 3, 225: 20, 227: 11, 228: 16, 229: 3, 230: 7, 231: 6, 232: 10, 233: 10, 234: 22, 235: 13, 236: 9, 237: 16, 238: 18, 240: 1, 241: 1, 242: 6, 243: 6, 244: 4, 245: 4, 246: 8, 247: 13, 248: 28, 250: 1, 251: 26, 252: 75, 253: 3, 254: 14, 255: 2, 256: 39, 257: 3, 258: 2, 259: 116, 260: 45, 261: 27, 262: 31, 263: 15, 264: 29, 265: 1, 266: 3, 267: 60, 268: 79, 269: 28, 270: 20, 271: 4, 272: 40, 273: 3, 275: 1, 276: 6, 277: 36, 278: 2, 279: 33, 280: 13, 281: 4, 282: 6, 283: 14, 284: 10, 285: 8, 286: 3, 287: 7, 289: 9, 290: 31, 291: 46, 292: 89, 293: 17, 294: 10, 295: 29, 296: 72, 297: 4, 298: 24, 299: 15, 300: 39, 301: 17, 302: 20, 304: 9, 305: 6, 306: 2, 307: 6, 308: 61, 309: 17, 310: 55, 311: 15, 312: 9, 313: 23, 314: 3, 316: 5, 318: 2, 322: 1, 323: 5, 324: 7, 327: 2, 328: 1, 329: 1, 330: 1, 331: 2, 333: 2, 335: 3, 336: 6, 338: 5, 339: 5, 342: 1, 343: 14, 345: 8, 346: 8, 347: 2, 348: 3, 349: 12, 350: 3, 351: 8, 352: 1, 353: 1, 354: 3, 355: 8, 356: 6, 357: 6, 358: 2, 359: 2, 360: 6, 362: 2, 363: 1, 365: 9, 366: 12, 367: 5, 368: 4, 369: 3, 371: 10, 372: 6, 374: 1, 377: 1, 379: 4, 382: 1, 384: 251, 388: 3, 389: 23, 392: 20, 393: 20, 394: 8, 395: 16, 396: 7, 397: 1, 398: 4, 400: 46, 401: 2, 402: 2, 403: 5, 404: 2, 405: 1, 407: 4, 408: 31, 409: 73, 410: 15, 411: 1, 416: 11, 417: 1, 430: 3, 432: 6, 433: 2, 434: 1, 435: 1, 438: 4, 440: 2, 441: 2, 444: 15, 445: 4, 454: 2, 456: 1, 458: 9, 459: 3, 460: 18, 461: 3, 463: 2, 467: 4, 469: 2, 470: 7, 471: 5, 472: 4, 473: 1, 474: 11, 475: 8, 476: 3, 477: 5, 478: 9, 479: 3, 480: 49, 481: 4, 482: 5, 483: 1, 484: 14, 485: 2, 486: 3, 487: 19, 489: 1, 491: 2, 492: 15, 493: 1, 494: 10, 501: 2, 505: 4, 506: 11, 507: 2, 508: 5, 510: 1, 511: 1, 513: 1, 516: 1, 517: 3, 518: 1, 520: 2, 521: 1, 524: 2, 525: 1, 526: 1, 536: 3, 540: 3, 541: 9, 542: 2, 543: 5, 544: 2, 545: 1, 546: 2, 547: 6, 552: 15, 553: 1, 554: 1}

I can work out that the tuple "114: 31" in  line 7 of this data corresponds to that information but I can't see a way to hook ' ixlan = 114' to 'ixid = 132'.

How do you link them for the web page? 


On Mon, Jun 22, 2015 at 3:29 PM, Matt Griswold <grizz@20c.com> wrote:
* Andy Linton <asjl@nsrc.org> [150622 14:38 +1200]:
> I'm keen to get an answer on this - is there a different place I
>   should ask these questions?
Sorry, embarrassed to admit I just realized I wasn't subscribed to the
lists a few hours ago.

Server side querying for that will happen with
https://github.com/peeringdb/1to2/issues/8 - which is next on our list.
Currently, it's just download everything and sort through it on your
side, would it help to have better docs for that?

> On Thu, Jun 18, 2015 at 10:46 AM, Andy Linton <asjl@nsrc.org> wrote:
> > So I'm trying to do this using the API and I can see that I can
> >   look at the 'netix' API data and work out who peers at each
> >   unique "ix_lan" instance. For example, I can deduce that ix_lan
> >   == 114 means the WIX-NZ. My network has:
> >
> >     {
> >       "network": 7662,
> >       "ix_lan": 114,
> >       "notes": "",
> >       "speed": 4,
> >       "asn": 132003,
> >       "ipaddr4": "202.7.0.190",
> >       "ipaddr6": "2001:7fa:3:ca07::be"
> >     },
> >
> >
> >
> > But if I look for this ID in the 'ixlan' API data there's no entry
> >   for 114 and there appears to be no way to map this back to the
> >   'ix' entry for WIX-NZ which has id == 132
> >
> > I'm guessing that the 'ixlan' data is not populated in any
> >   meaningful way as all entries seem to be of this form:
> >
> >    {
> >       "ix": 11017,
> >       "name": "",
> >       "descr": "",
> >       "mtu": null,
> >       "dot1q_support": false,
> >       "rs_asn": 0
> >     },
> >
> > Am I missing something here?
The ixlan itself is currently unpopulated (since the data isn't in
PeeringDB), but will be populated in part from IXF, and once it's
available, IXes will be able to populate it themselves. It should have a
list of the networks on it, I've created that bug here:
https://github.com/peeringdb/1to2/issues/40

Again, if you download all the data you can form these queries on your
own.