annet 2.5.1__tar.gz → 2.5.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of annet might be problematic. Click here for more details.

Files changed (204) hide show
  1. {annet-2.5.1/annet.egg-info → annet-2.5.3}/PKG-INFO +1 -1
  2. {annet-2.5.1 → annet-2.5.3}/annet/annlib/netdev/views/hardware.py +2 -0
  3. {annet-2.5.1 → annet-2.5.3}/annet/api/__init__.py +32 -31
  4. {annet-2.5.1 → annet-2.5.3}/annet/generators/jsonfragment.py +8 -5
  5. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/b4com/iface.py +10 -0
  6. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/texts/b4com.order +11 -0
  7. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/texts/b4com.rul +4 -1
  8. {annet-2.5.1 → annet-2.5.3/annet.egg-info}/PKG-INFO +1 -1
  9. {annet-2.5.1 → annet-2.5.3}/AUTHORS +0 -0
  10. {annet-2.5.1 → annet-2.5.3}/LICENSE +0 -0
  11. {annet-2.5.1 → annet-2.5.3}/MANIFEST.in +0 -0
  12. {annet-2.5.1 → annet-2.5.3}/README.md +0 -0
  13. {annet-2.5.1 → annet-2.5.3}/annet/__init__.py +0 -0
  14. {annet-2.5.1 → annet-2.5.3}/annet/adapters/__init__.py +0 -0
  15. {annet-2.5.1 → annet-2.5.3}/annet/adapters/fetchers/__init__.py +0 -0
  16. {annet-2.5.1 → annet-2.5.3}/annet/adapters/fetchers/stub/__init__.py +0 -0
  17. {annet-2.5.1 → annet-2.5.3}/annet/adapters/fetchers/stub/fetcher.py +0 -0
  18. {annet-2.5.1 → annet-2.5.3}/annet/adapters/file/__init__.py +0 -0
  19. {annet-2.5.1 → annet-2.5.3}/annet/adapters/file/provider.py +0 -0
  20. {annet-2.5.1 → annet-2.5.3}/annet/adapters/netbox/__init__.py +0 -0
  21. {annet-2.5.1 → annet-2.5.3}/annet/adapters/netbox/common/__init__.py +0 -0
  22. {annet-2.5.1 → annet-2.5.3}/annet/adapters/netbox/common/adapter.py +0 -0
  23. {annet-2.5.1 → annet-2.5.3}/annet/adapters/netbox/common/client.py +0 -0
  24. {annet-2.5.1 → annet-2.5.3}/annet/adapters/netbox/common/manufacturer.py +0 -0
  25. {annet-2.5.1 → annet-2.5.3}/annet/adapters/netbox/common/models.py +0 -0
  26. {annet-2.5.1 → annet-2.5.3}/annet/adapters/netbox/common/query.py +0 -0
  27. {annet-2.5.1 → annet-2.5.3}/annet/adapters/netbox/common/status_client.py +0 -0
  28. {annet-2.5.1 → annet-2.5.3}/annet/adapters/netbox/common/storage_base.py +0 -0
  29. {annet-2.5.1 → annet-2.5.3}/annet/adapters/netbox/common/storage_opts.py +0 -0
  30. {annet-2.5.1 → annet-2.5.3}/annet/adapters/netbox/provider.py +0 -0
  31. {annet-2.5.1 → annet-2.5.3}/annet/adapters/netbox/v24/__init__.py +0 -0
  32. {annet-2.5.1 → annet-2.5.3}/annet/adapters/netbox/v24/models.py +0 -0
  33. {annet-2.5.1 → annet-2.5.3}/annet/adapters/netbox/v24/storage.py +0 -0
  34. {annet-2.5.1 → annet-2.5.3}/annet/adapters/netbox/v37/__init__.py +0 -0
  35. {annet-2.5.1 → annet-2.5.3}/annet/adapters/netbox/v37/models.py +0 -0
  36. {annet-2.5.1 → annet-2.5.3}/annet/adapters/netbox/v37/storage.py +0 -0
  37. {annet-2.5.1 → annet-2.5.3}/annet/adapters/netbox/v41/__init__.py +0 -0
  38. {annet-2.5.1 → annet-2.5.3}/annet/adapters/netbox/v41/models.py +0 -0
  39. {annet-2.5.1 → annet-2.5.3}/annet/adapters/netbox/v41/storage.py +0 -0
  40. {annet-2.5.1 → annet-2.5.3}/annet/adapters/netbox/v42/__init__.py +0 -0
  41. {annet-2.5.1 → annet-2.5.3}/annet/adapters/netbox/v42/models.py +0 -0
  42. {annet-2.5.1 → annet-2.5.3}/annet/adapters/netbox/v42/storage.py +0 -0
  43. {annet-2.5.1 → annet-2.5.3}/annet/annet.py +0 -0
  44. {annet-2.5.1 → annet-2.5.3}/annet/annlib/__init__.py +0 -0
  45. {annet-2.5.1 → annet-2.5.3}/annet/annlib/command.py +0 -0
  46. {annet-2.5.1 → annet-2.5.3}/annet/annlib/diff.py +0 -0
  47. {annet-2.5.1 → annet-2.5.3}/annet/annlib/errors.py +0 -0
  48. {annet-2.5.1 → annet-2.5.3}/annet/annlib/filter_acl.py +0 -0
  49. {annet-2.5.1 → annet-2.5.3}/annet/annlib/jsontools.py +0 -0
  50. {annet-2.5.1 → annet-2.5.3}/annet/annlib/lib.py +0 -0
  51. {annet-2.5.1 → annet-2.5.3}/annet/annlib/netdev/__init__.py +0 -0
  52. {annet-2.5.1 → annet-2.5.3}/annet/annlib/netdev/db.py +0 -0
  53. {annet-2.5.1 → annet-2.5.3}/annet/annlib/netdev/devdb/__init__.py +0 -0
  54. {annet-2.5.1 → annet-2.5.3}/annet/annlib/netdev/devdb/data/devdb.json +0 -0
  55. {annet-2.5.1 → annet-2.5.3}/annet/annlib/netdev/views/__init__.py +0 -0
  56. {annet-2.5.1 → annet-2.5.3}/annet/annlib/netdev/views/dump.py +0 -0
  57. {annet-2.5.1 → annet-2.5.3}/annet/annlib/output.py +0 -0
  58. {annet-2.5.1 → annet-2.5.3}/annet/annlib/patching.py +0 -0
  59. {annet-2.5.1 → annet-2.5.3}/annet/annlib/rbparser/__init__.py +0 -0
  60. {annet-2.5.1 → annet-2.5.3}/annet/annlib/rbparser/acl.py +0 -0
  61. {annet-2.5.1 → annet-2.5.3}/annet/annlib/rbparser/deploying.py +0 -0
  62. {annet-2.5.1 → annet-2.5.3}/annet/annlib/rbparser/ordering.py +0 -0
  63. {annet-2.5.1 → annet-2.5.3}/annet/annlib/rbparser/platform.py +0 -0
  64. {annet-2.5.1 → annet-2.5.3}/annet/annlib/rbparser/syntax.py +0 -0
  65. {annet-2.5.1 → annet-2.5.3}/annet/annlib/rulebook/__init__.py +0 -0
  66. {annet-2.5.1 → annet-2.5.3}/annet/annlib/rulebook/common.py +0 -0
  67. {annet-2.5.1 → annet-2.5.3}/annet/annlib/tabparser.py +0 -0
  68. {annet-2.5.1 → annet-2.5.3}/annet/annlib/types.py +0 -0
  69. {annet-2.5.1 → annet-2.5.3}/annet/argparse.py +0 -0
  70. {annet-2.5.1 → annet-2.5.3}/annet/bgp_models.py +0 -0
  71. {annet-2.5.1 → annet-2.5.3}/annet/cli.py +0 -0
  72. {annet-2.5.1 → annet-2.5.3}/annet/cli_args.py +0 -0
  73. {annet-2.5.1 → annet-2.5.3}/annet/configs/context.yml +0 -0
  74. {annet-2.5.1 → annet-2.5.3}/annet/configs/logging.yaml +0 -0
  75. {annet-2.5.1 → annet-2.5.3}/annet/connectors.py +0 -0
  76. {annet-2.5.1 → annet-2.5.3}/annet/deploy.py +0 -0
  77. {annet-2.5.1 → annet-2.5.3}/annet/deploy_ui.py +0 -0
  78. {annet-2.5.1 → annet-2.5.3}/annet/diff.py +0 -0
  79. {annet-2.5.1 → annet-2.5.3}/annet/executor.py +0 -0
  80. {annet-2.5.1 → annet-2.5.3}/annet/filtering.py +0 -0
  81. {annet-2.5.1 → annet-2.5.3}/annet/gen.py +0 -0
  82. {annet-2.5.1 → annet-2.5.3}/annet/generators/__init__.py +0 -0
  83. {annet-2.5.1 → annet-2.5.3}/annet/generators/base.py +0 -0
  84. {annet-2.5.1 → annet-2.5.3}/annet/generators/common/__init__.py +0 -0
  85. {annet-2.5.1 → annet-2.5.3}/annet/generators/common/initial.py +0 -0
  86. {annet-2.5.1 → annet-2.5.3}/annet/generators/entire.py +0 -0
  87. {annet-2.5.1 → annet-2.5.3}/annet/generators/exceptions.py +0 -0
  88. {annet-2.5.1 → annet-2.5.3}/annet/generators/partial.py +0 -0
  89. {annet-2.5.1 → annet-2.5.3}/annet/generators/perf.py +0 -0
  90. {annet-2.5.1 → annet-2.5.3}/annet/generators/ref.py +0 -0
  91. {annet-2.5.1 → annet-2.5.3}/annet/generators/result.py +0 -0
  92. {annet-2.5.1 → annet-2.5.3}/annet/hardware.py +0 -0
  93. {annet-2.5.1 → annet-2.5.3}/annet/implicit.py +0 -0
  94. {annet-2.5.1 → annet-2.5.3}/annet/lib.py +0 -0
  95. {annet-2.5.1 → annet-2.5.3}/annet/mesh/__init__.py +0 -0
  96. {annet-2.5.1 → annet-2.5.3}/annet/mesh/basemodel.py +0 -0
  97. {annet-2.5.1 → annet-2.5.3}/annet/mesh/device_models.py +0 -0
  98. {annet-2.5.1 → annet-2.5.3}/annet/mesh/executor.py +0 -0
  99. {annet-2.5.1 → annet-2.5.3}/annet/mesh/match_args.py +0 -0
  100. {annet-2.5.1 → annet-2.5.3}/annet/mesh/models_converter.py +0 -0
  101. {annet-2.5.1 → annet-2.5.3}/annet/mesh/peer_models.py +0 -0
  102. {annet-2.5.1 → annet-2.5.3}/annet/mesh/port_processor.py +0 -0
  103. {annet-2.5.1 → annet-2.5.3}/annet/mesh/registry.py +0 -0
  104. {annet-2.5.1 → annet-2.5.3}/annet/output.py +0 -0
  105. {annet-2.5.1 → annet-2.5.3}/annet/parallel.py +0 -0
  106. {annet-2.5.1 → annet-2.5.3}/annet/patching.py +0 -0
  107. {annet-2.5.1 → annet-2.5.3}/annet/reference.py +0 -0
  108. {annet-2.5.1 → annet-2.5.3}/annet/rpl/__init__.py +0 -0
  109. {annet-2.5.1 → annet-2.5.3}/annet/rpl/action.py +0 -0
  110. {annet-2.5.1 → annet-2.5.3}/annet/rpl/condition.py +0 -0
  111. {annet-2.5.1 → annet-2.5.3}/annet/rpl/match_builder.py +0 -0
  112. {annet-2.5.1 → annet-2.5.3}/annet/rpl/policy.py +0 -0
  113. {annet-2.5.1 → annet-2.5.3}/annet/rpl/result.py +0 -0
  114. {annet-2.5.1 → annet-2.5.3}/annet/rpl/routemap.py +0 -0
  115. {annet-2.5.1 → annet-2.5.3}/annet/rpl/statement_builder.py +0 -0
  116. {annet-2.5.1 → annet-2.5.3}/annet/rpl_generators/__init__.py +0 -0
  117. {annet-2.5.1 → annet-2.5.3}/annet/rpl_generators/aspath.py +0 -0
  118. {annet-2.5.1 → annet-2.5.3}/annet/rpl_generators/community.py +0 -0
  119. {annet-2.5.1 → annet-2.5.3}/annet/rpl_generators/cumulus_frr.py +0 -0
  120. {annet-2.5.1 → annet-2.5.3}/annet/rpl_generators/entities.py +0 -0
  121. {annet-2.5.1 → annet-2.5.3}/annet/rpl_generators/execute.py +0 -0
  122. {annet-2.5.1 → annet-2.5.3}/annet/rpl_generators/policy.py +0 -0
  123. {annet-2.5.1 → annet-2.5.3}/annet/rpl_generators/prefix_lists.py +0 -0
  124. {annet-2.5.1 → annet-2.5.3}/annet/rpl_generators/rd.py +0 -0
  125. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/__init__.py +0 -0
  126. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/arista/__init__.py +0 -0
  127. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/arista/aaa.py +0 -0
  128. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/arista/iface.py +0 -0
  129. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/aruba/__init__.py +0 -0
  130. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/aruba/ap_env.py +0 -0
  131. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/aruba/misc.py +0 -0
  132. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/b4com/__init__.py +0 -0
  133. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/b4com/file.py +0 -0
  134. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/cisco/__init__.py +0 -0
  135. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/cisco/iface.py +0 -0
  136. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/cisco/misc.py +0 -0
  137. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/cisco/vlandb.py +0 -0
  138. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/common.py +0 -0
  139. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/deploying.py +0 -0
  140. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/huawei/__init__.py +0 -0
  141. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/huawei/aaa.py +0 -0
  142. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/huawei/bgp.py +0 -0
  143. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/huawei/iface.py +0 -0
  144. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/huawei/misc.py +0 -0
  145. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/huawei/vlandb.py +0 -0
  146. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/juniper/__init__.py +0 -0
  147. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/nexus/__init__.py +0 -0
  148. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/nexus/iface.py +0 -0
  149. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/patching.py +0 -0
  150. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/routeros/__init__.py +0 -0
  151. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/routeros/file.py +0 -0
  152. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/texts/arista.deploy +0 -0
  153. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/texts/arista.order +0 -0
  154. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/texts/arista.rul +0 -0
  155. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/texts/aruba.deploy +0 -0
  156. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/texts/aruba.order +0 -0
  157. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/texts/aruba.rul +0 -0
  158. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/texts/b4com.deploy +0 -0
  159. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/texts/cisco.deploy +0 -0
  160. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/texts/cisco.order +0 -0
  161. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/texts/cisco.rul +0 -0
  162. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/texts/huawei.deploy +0 -0
  163. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/texts/huawei.order +0 -0
  164. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/texts/huawei.rul +0 -0
  165. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/texts/juniper.order +0 -0
  166. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/texts/juniper.rul +0 -0
  167. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/texts/nexus.deploy +0 -0
  168. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/texts/nexus.order +0 -0
  169. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/texts/nexus.rul +0 -0
  170. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/texts/nokia.rul +0 -0
  171. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/texts/optixtrans.deploy +0 -0
  172. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/texts/optixtrans.order +0 -0
  173. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/texts/optixtrans.rul +0 -0
  174. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/texts/pc.deploy +0 -0
  175. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/texts/pc.order +0 -0
  176. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/texts/pc.rul +0 -0
  177. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/texts/ribbon.deploy +0 -0
  178. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/texts/ribbon.rul +0 -0
  179. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/texts/routeros.order +0 -0
  180. {annet-2.5.1 → annet-2.5.3}/annet/rulebook/texts/routeros.rul +0 -0
  181. {annet-2.5.1 → annet-2.5.3}/annet/storage.py +0 -0
  182. {annet-2.5.1 → annet-2.5.3}/annet/tabparser.py +0 -0
  183. {annet-2.5.1 → annet-2.5.3}/annet/text_term_format.py +0 -0
  184. {annet-2.5.1 → annet-2.5.3}/annet/tracing.py +0 -0
  185. {annet-2.5.1 → annet-2.5.3}/annet/types.py +0 -0
  186. {annet-2.5.1 → annet-2.5.3}/annet.egg-info/SOURCES.txt +0 -0
  187. {annet-2.5.1 → annet-2.5.3}/annet.egg-info/dependency_links.txt +0 -0
  188. {annet-2.5.1 → annet-2.5.3}/annet.egg-info/entry_points.txt +0 -0
  189. {annet-2.5.1 → annet-2.5.3}/annet.egg-info/requires.txt +0 -0
  190. {annet-2.5.1 → annet-2.5.3}/annet.egg-info/top_level.txt +0 -0
  191. {annet-2.5.1 → annet-2.5.3}/annet_generators/__init__.py +0 -0
  192. {annet-2.5.1 → annet-2.5.3}/annet_generators/example/__init__.py +0 -0
  193. {annet-2.5.1 → annet-2.5.3}/annet_generators/example/lldp.py +0 -0
  194. {annet-2.5.1 → annet-2.5.3}/annet_generators/mesh_example/__init__.py +0 -0
  195. {annet-2.5.1 → annet-2.5.3}/annet_generators/mesh_example/bgp.py +0 -0
  196. {annet-2.5.1 → annet-2.5.3}/annet_generators/mesh_example/mesh_logic.py +0 -0
  197. {annet-2.5.1 → annet-2.5.3}/annet_generators/rpl_example/__init__.py +0 -0
  198. {annet-2.5.1 → annet-2.5.3}/annet_generators/rpl_example/generator.py +0 -0
  199. {annet-2.5.1 → annet-2.5.3}/annet_generators/rpl_example/items.py +0 -0
  200. {annet-2.5.1 → annet-2.5.3}/annet_generators/rpl_example/mesh.py +0 -0
  201. {annet-2.5.1 → annet-2.5.3}/annet_generators/rpl_example/route_policy.py +0 -0
  202. {annet-2.5.1 → annet-2.5.3}/requirements.txt +0 -0
  203. {annet-2.5.1 → annet-2.5.3}/setup.cfg +0 -0
  204. {annet-2.5.1 → annet-2.5.3}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: annet
3
- Version: 2.5.1
3
+ Version: 2.5.3
4
4
  Summary: annet
5
5
  Home-page: https://github.com/annetutil/annet
6
6
  License: MIT
@@ -152,5 +152,7 @@ def svi_name(hw: HardwareView, num: int) -> str:
152
152
  return f"irb.{num}"
153
153
  elif hw.Huawei:
154
154
  return f"Vlanif{num}"
155
+ elif hw.Arista or hw.Cisco:
156
+ return f"Vlan{num}"
155
157
  else:
156
158
  return f"vlan{num}"
@@ -582,43 +582,44 @@ class Deployer:
582
582
  return ans
583
583
 
584
584
  def check_diff(self, result: annet.deploy.DeployResult, loader: ann_gen.Loader):
585
- success_device_ids = []
586
- for host, hres in result.results.items():
587
- device = self.fqdn_to_device[host]
588
- if (
589
- not isinstance(hres, Exception) and
590
- host not in self.empty_diff_hostnames and
591
- device.is_pc()
592
- ):
593
- success_device_ids.append(device.id)
594
585
  diff_args = self.args.copy_from(
595
586
  self.args,
596
587
  config="running",
597
588
  )
589
+ if not diff_args.query:
590
+ return
598
591
 
599
- if diff_args.query:
600
- ann_gen.live_configs = None
601
-
602
- diffs, failed = diff(diff_args, loader, success_device_ids)
603
- for device_id, exc in failed.items():
604
- self.failed_configs[loader.get_device(device_id).fqdn] = exc
605
-
606
- non_pc_diffs = {
607
- loader.get_device(device_id): diff
608
- for device_id, diff in diffs.items()
609
- if not isinstance(diff, PCDiff)
610
- }
611
- devices_to_diff = ann_diff.collapse_diffs(non_pc_diffs)
612
- devices_to_diff.update({
613
- (loader.get_device(device_id),): diff
614
- for device_id, diff in diffs.items()
615
- if isinstance(diff, PCDiff)}
616
- )
617
- else:
618
- devices_to_diff = {}
592
+ # clear cache
593
+ ann_gen.live_configs = None
619
594
 
620
- for devices, diff_obj in devices_to_diff.items():
621
- if diff_obj:
595
+ # collect new diffs for devices on which we had successfully uploaded something
596
+ success_device_ids = []
597
+ for host, hres in result.results.items():
598
+ if (
599
+ not isinstance(hres, Exception) and
600
+ host not in self.empty_diff_hostnames
601
+ ):
602
+ device = self.fqdn_to_device[host]
603
+ success_device_ids.append(device.id)
604
+ diffs, failed = diff(diff_args, loader, success_device_ids)
605
+ for device_id, exc in failed.items():
606
+ self.failed_configs[loader.get_device(device_id).fqdn] = exc
607
+
608
+ # "collapse" non-PC diffs
609
+ diffs_by_device_id = ann_diff.collapse_diffs({
610
+ loader.get_device(device_id): diff
611
+ for device_id, diff in diffs.items()
612
+ if diff and not isinstance(diff, PCDiff)
613
+ })
614
+ # add PC diffs as is
615
+ diffs_by_device_id.update({
616
+ (loader.get_device(device_id),): diff
617
+ for device_id, diff in diffs.items()
618
+ if diff and isinstance(diff, PCDiff)
619
+ })
620
+ if diffs_by_device_id:
621
+ print("The diff is still present:")
622
+ for devices, diff_obj in diffs_by_device_id.items():
622
623
  for dev in devices:
623
624
  self.failed_configs[dev.fqdn] = Warning("Deploy OK, but diff still exists")
624
625
  if isinstance(diff_obj, PCDiff):
@@ -12,7 +12,6 @@ from typing import (
12
12
 
13
13
  from annet.storage import Device, Storage
14
14
  from .base import TreeGenerator, _filter_str
15
- from .exceptions import NotSupportedDevice
16
15
 
17
16
 
18
17
  class JSONFragment(TreeGenerator):
@@ -115,13 +114,17 @@ class JSONFragment(TreeGenerator):
115
114
  return self.process_scalar_value(value)
116
115
 
117
116
  def _set_dict(self, cfg, pointer, value):
117
+ processed_value = self.process_value(value)
118
118
  # pointer has at least one key
119
119
  if len(pointer) == 1:
120
120
  if pointer[0] in cfg:
121
- cfg[pointer[0]] = [cfg[pointer[0]], self.process_value(value)]
122
- else:
123
- cfg[pointer[0]] = self.process_value(value)
121
+ # conflict, generator tries to insert key that already exists
122
+ raise ValueError(
123
+ f"Key {pointer[0]} already exists in config. "
124
+ f"Existing value: {cfg[pointer[0]]}, new value: {processed_value}"
125
+ )
126
+ cfg[pointer[0]] = processed_value
124
127
  else:
125
128
  if pointer[0] not in cfg:
126
129
  cfg[pointer[0]] = {}
127
- self._set_dict(cfg[pointer[0]], pointer[1:], self.process_value(value))
130
+ self._set_dict(cfg[pointer[0]], pointer[1:], processed_value)
@@ -13,6 +13,16 @@ def mtu(rule, key, diff, **kwargs):
13
13
  yield from common.default(rule, key, diff, **kwargs)
14
14
 
15
15
 
16
+ def description(rule, key, diff, **kwargs):
17
+ """
18
+ Удаляем description без указания значения
19
+ """
20
+ if diff[Op.REMOVED]:
21
+ yield (False, "no description", None)
22
+ elif diff[Op.ADDED]:
23
+ yield from common.default(rule, key, diff, **kwargs)
24
+
25
+
16
26
  def sflow(rule, key, diff, **kwargs):
17
27
  """
18
28
  Команда sflow sampling-rate * direction ingress max-header-size *
@@ -6,3 +6,14 @@
6
6
  # Фичи должны быть включены прежде всего
7
7
  feature
8
8
  # Далее нужно будет указать команды и их порядок
9
+ interface *
10
+ description
11
+ ip vrf forwarding
12
+ ipv6 address
13
+ mtu
14
+ lldp-agent
15
+ set lldp
16
+ lldp tlv
17
+ dcbx
18
+ exit
19
+ sflow
@@ -13,7 +13,10 @@
13
13
  # Physical
14
14
  sflow *
15
15
 
16
- interface */(ce|xe)[0-9\/]+$/ %logic=common.permanent %diff_logic=cisco.iface.diff
16
+ interface */(ce|xe|eth)[0-9\/]+$/ %logic=common.permanent %diff_logic=cisco.iface.diff
17
+ description * %logic=b4com.iface.description
18
+ ip vrf forwarding *
19
+ ip address *
17
20
  ipv6 address *
18
21
  mtu * %logic=b4com.iface.mtu
19
22
  sflow * %logic=b4com.iface.sflow
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: annet
3
- Version: 2.5.1
3
+ Version: 2.5.3
4
4
  Summary: annet
5
5
  Home-page: https://github.com/annetutil/annet
6
6
  License: MIT
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes