Skip to content
This repository has been archived by the owner on May 15, 2019. It is now read-only.

Dbarrosop/simplifications #68

Merged
merged 9 commits into from
Jul 1, 2017
Merged

Dbarrosop/simplifications #68

merged 9 commits into from
Jul 1, 2017

Conversation

dbarrosop
Copy link
Member

@dbarrosop dbarrosop commented Jun 19, 2017

Changes:

  • Move mandatory elements, previously on the default action, to a dedicated action
  • from is optional, by default it will always follow the parent
  • from is now a pointer, no need to keep serializing/deserializing
  • mode is optional. All parsers have a main default action now.
  • On the JSONParser side of things, which was recently introduced by @bewing recently:
    • it's been refactored so it looks more like the XMLParser. At some point I'd actually get rid of the XMLParser and use only the JSONParser. The XMLParser would just convert initially the XML object into a dictionary and have the JSONParser deal with it
    • I got rid of some parsers because there were no tests and they are certainly broken after my changes
    • Things like subinterfaces are now supported.

Pinging @matejv @bewing @mirceaulinic @ktbyers

The idea is to start getting rid of redundant things and make things as consistent and easy as possible. Simplification are far from complete so feel free to propose other changes that you think might be worth exploring.

@@ -27,82 +28,68 @@ interfaces:
admin-status:
_process:
- mode: map
value: "{{ bookmarks.parent.get('interfaceStatus', 'disabled') }}"
path: interfaceStatus
defaul: disabled
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guessing this is a typo

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thanks! I am actually going to remove the default argument. I don't think it's needed.

@@ -1 +1,323 @@
{"interfaces": {"Management1": {"lastStatusChangeTimestamp": 1497732472.6491787, "name": "Management1", "interfaceStatus": "connected", "autoNegotiate": "success", "description": "", "burnedInAddress": "08:00:27:6b:fa:fe", "bandwidth": 1000000000, "mtu": 1500, "hardware": "ethernet", "duplex": "duplexFull", "loopbackMode": "loopbackNone", "physicalAddress": "08:00:27:6b:fa:fe", "interfaceCounters": {"outBroadcastPkts": 0, "linkStatusChanges": 5, "totalOutErrors": 0, "inMulticastPkts": 0, "counterRefreshTime": 1497734297.210793, "inBroadcastPkts": 19, "inputErrorsDetail": {"runtFrames": 0, "fcsErrors": 0, "alignmentErrors": 0, "rxPause": 0, "symbolErrors": 0, "giantFrames": 0}, "inOctets": 97807, "outDiscards": 0, "outOctets": 112236, "inUcastPkts": 0, "outputErrorsDetail": {"lateCollisions": 0, "deferredTransmissions": 0, "txPause": 0, "collisions": 0}, "outUcastPkts": 758, "outMulticastPkts": 0, "totalInErrors": 0, "inDiscards": 0}, "interfaceStatistics": {"inBitsRate": 327.13344777831077, "updateInterval": 300.0, "outBitsRate": 513.747345263329, "outPktsRate": 0.3882478230578469, "inPktsRate": 0.00013831271000537475}, "interfaceAddress": [{"secondaryIpsOrderedList": [], "primaryIp": {"maskLen": 24, "address": "10.0.2.15"}, "broadcastAddress": "255.255.255.255", "secondaryIps": {}, "virtualIp": {"maskLen": 0, "address": "0.0.0.0"}}], "lineProtocolStatus": "up", "forwardingModel": "routed"}, "Ethernet1": {"lastStatusChangeTimestamp": 1497732461.1365635, "name": "Ethernet1", "interfaceStatus": "connected", "autoNegotiate": "unknown", "description": "", "bandwidth": 0, "mtu": 1500, "hardware": "ethernet", "duplex": "duplexFull", "loopbackMode": "loopbackNone", "physicalAddress": "08:00:27:66:ef:40", "interfaceCounters": {"outBroadcastPkts": 0, "linkStatusChanges": 1, "lastClear": 1497732401.4158947, "inMulticastPkts": 97, "counterRefreshTime": 1497734297.214895, "inBroadcastPkts": 2630, "inputErrorsDetail": {"runtFrames": 0, "fcsErrors": 0, "alignmentErrors": 0, "rxPause": 0, "symbolErrors": 0, "giantFrames": 0}, "inOctets": 212355, "outDiscards": 0, "outOctets": 43559, "inUcastPkts": 118, "outputErrorsDetail": {"lateCollisions": 0, "deferredTransmissions": 0, "txPause": 0, "collisions": 0}, "outUcastPkts": 104, "outMulticastPkts": 73, "totalInErrors": 0, "inDiscards": 0, "totalOutErrors": 0}, "interfaceStatistics": {"inBitsRate": 0.0, "updateInterval": 300.0, "outBitsRate": 0.0, "outPktsRate": 0.0, "inPktsRate": 0.0}, "interfaceAddress": [{"secondaryIpsOrderedList": [], "primaryIp": {"maskLen": 24, "address": "192.168.50.11"}, "broadcastAddress": "255.255.255.255", "secondaryIps": {}, "virtualIp": {"maskLen": 0, "address": "0.0.0.0"}}], "lineProtocolStatus": "up", "forwardingModel": "routed"}}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to have further discussion regarding the test cases, especially as we start having more complex models that may have multiple commands. As it stands, the single .native file is read as a string, as passed as the complete string being sole list entry in native. How would we make this work when dealing with mappings that require multiple command execution?

Not saying we have to solve this now, just that it's still on my mind.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to that. An easy solution would be to name the file yadda.native.0, yadda.native.1 and use the number to place them in the correct position in the list.

@bewing
Copy link
Member

bewing commented Jun 20, 2017

Will do some performance testing of oc-platform and my _oc_platform() method tomorrow.

@dbarrosop dbarrosop merged commit c6e30fd into develop Jul 1, 2017
@dbarrosop dbarrosop deleted the dbarrosop/simplifications branch July 1, 2017 08:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants