These are chat archives for allegro/ralph

27th
Jul 2016
Michał Suszko
@msuszko
Jul 27 2016 11:43
Looks like we won't be merging your code after #2336 anymore
Mateusz Kurek
@mkurek
Jul 27 2016 11:47
why? do you have a lot of merge conflicts? or sth is not "compatible" with your requirements and needs?
Michał Suszko
@msuszko
Jul 27 2016 11:51
Trying to keep foreign key from IP to network and automatically generating fake MAC addresses when saving IP are weird to me
Mateusz Kurek
@mkurek
Jul 27 2016 11:52
so, how should it look like according to you? :)
(btw we don't generate fake mac addresses - we create Ethernet object without mac)
Mateusz Kurek
@mkurek
Jul 27 2016 11:57
and about keeping FK from IP to network - yes - it causes today a bug in deployment, so i'm open to improvement ideas (ex. calculating it dynamically, based on ip/net address)
Michał Suszko
@msuszko
Jul 27 2016 12:07
Don't you have interfaces other than ethernet? What about tunnels or IPoIB
I prefer to just link IP to an asset
another problem with IP <--> Ethernet mapping are bonded interfaces
Finding network for IP is easy, just choose smallest network that matches the IP
Michał Suszko
@msuszko
Jul 27 2016 12:13
Does MySQL have indexable ranges field?
Mateusz Kurek
@mkurek
Jul 27 2016 12:16
starting from the end - if yes, than what's the problem in keeping this info as a FK from ip to network? and mysql afaik does not have such field (and in django it's postgres-specific))
about mapping ip to ethernet, we've considered linking ip to asset directly, but in Ralph2 we had so much troubles because of that. If we link ip to asset, we have to do separate model for DHCPEntry, not linked (or maybe linked?) to any of ethernet or ip - if it will be linked, we have to keep it in valid state (ex. ethernet is pointing to other asset than ip). In our solution everything looks straightforward - one way to set this. About other interfaces - we could create some other inheritance model, like GenericInterface (and IP will link to it), Ethernet could inherit from it and we could create new models for other interfaces (like you said, ex. tunnels etc). For bonding maybe we could create sth similar.
Mateusz Kurek
@mkurek
Jul 27 2016 12:21
When ip is not connected to interface (ex. ethernet), how would you know on what iterface what ip is attached? Do you want to create link from interface to ip?
Michał Suszko
@msuszko
Jul 27 2016 13:39
Network is abstract, a range with some attributes you can describe
like gateways, segment, VLAN
IP is part of many nested networks, and when you create smaller subnet you have to rewrite foreign keys in thos model, or when you remove subnet
And what is this foreign key for really?
You can find all networks matchong IP address and its segment with simple DB query
Michał Suszko
@msuszko
Jul 27 2016 13:46
as of IP and Ethernets addresses. I'd add text field to IP to keep interface name
and link it to an asset
The same for Ethernet addresses
One could create separate model for interfaces to create sth like Asset <-- Interface <-- IPaddress and Asset <-- Interface <-- MACaddress, and keep interface attributes, but this adds yet another link in DB I don't really have use for
Michał Suszko
@msuszko
Jul 27 2016 13:55
There is no problem in MySQL finding networks IP address is in, it will just use range index scan using only one boundary