Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add an exclude option to permitted subnets to exclude small chunks of a bit block #203

Closed
bb-Ricardo opened this issue Jun 22, 2022 · 13 comments
Milestone

Comments

@bb-Ricardo
Copy link
Owner

bb-Ricardo commented Jun 22, 2022

exclude subnets with a leading !
suggestion:

permitted_subnets = 172.16.0.0/12, 10.0.0.0/8, !10.8.0.0/24
@Eldiabolo21
Copy link

This seems to lead to a problem for me:

netbox-sync-netbox-syncer-1  | 2022-11-23 07:59:26,932 - INFO: Finished querying necessary objects from NetBox
netbox-sync-netbox-syncer-1  | 2022-11-23 07:59:26,932 - DEBUG: Start resolving relations
netbox-sync-netbox-syncer-1  | 2022-11-23 07:59:29,744 - DEBUG: Finished resolving relations
netbox-sync-netbox-syncer-1  | 2022-11-23 07:59:29,744 - DEBUG: Checking/Adding NetBox Sync dependencies
netbox-sync-netbox-syncer-1  | 2022-11-23 07:59:29,744 - DEBUG: Retrieving data from source 'my-redfish-example'
netbox-sync-netbox-syncer-1  | 2022-11-23 07:59:29,760 - DEBUG: Parsing inventory file /scripts/volume/redfish-inventory/bmc-srv010903.syseleven.net.json
netbox-sync-netbox-syncer-1  | Traceback (most recent call last):
netbox-sync-netbox-syncer-1  |   File "/netbox-sync/./netbox-sync.py", line 145, in <module>
netbox-sync-netbox-syncer-1  |     main()
netbox-sync-netbox-syncer-1  |   File "/netbox-sync/./netbox-sync.py", line 121, in main
netbox-sync-netbox-syncer-1  |     source.apply()
netbox-sync-netbox-syncer-1  |   File "/netbox-sync/module/sources/check_redfish/import_inventory.py", line 242, in apply
netbox-sync-netbox-syncer-1  |     self.update_network_interface()
netbox-sync-netbox-syncer-1  |   File "/netbox-sync/module/sources/check_redfish/import_inventory.py", line 852, in update_network_interface
netbox-sync-netbox-syncer-1  |     excluded_subnets=self.excluded_subnets, interface_name=port_name) is False:
netbox-sync-netbox-syncer-1  | AttributeError: 'CheckRedfish' object has no attribute 'excluded_subnets'. Did you mean: 'permitted_subnets'?
netbox-sync-netbox-syncer-1 exited with code 1

Weirdly enough, this only happens in a containerized version, when running in a venv ony my mac, it works flawless.

@bb-Ricardo
Copy link
Owner Author

Mhh, which python version are you running in your venv and which one in your docker container?

@Eldiabolo21
Copy link

Container (which throws the error) has Python 3.10.6, local install has Python 3.10.8

@bb-Ricardo
Copy link
Owner Author

very strange, actually no idea why there would be such a difference in behaviour between these two environments

@Eldiabolo21
Copy link

What do you suggest? I'm pretty sure this feature is the cause, if I check out the commit before this commit, it works.

@bb-Ricardo
Copy link
Owner Author

Hi,

I just pushed another commit. I'm certain I found the issue. Can you check out the latest development branch and see if it works?

Thank you

@Eldiabolo21
Copy link

Unfortunately still the issue, I'm sure i checked out the latest commit from the development branch.

netbox_syncer  | 2022-12-05 12:11:38,387 - INFO: Finished querying necessary objects from NetBox
netbox_syncer  | 2022-12-05 12:11:38,387 - DEBUG: Start resolving relations
netbox_syncer  | 2022-12-05 12:11:41,556 - DEBUG: Finished resolving relations
netbox_syncer  | 2022-12-05 12:11:41,556 - DEBUG: Checking/Adding NetBox Sync dependencies
netbox_syncer  | 2022-12-05 12:11:41,556 - DEBUG: Retrieving data from source 'my-redfish-example'
netbox_syncer  | 2022-12-05 12:11:41,581 - DEBUG: Parsing inventory file /scripts/volume/redfish-inventory/bmc-srv010903.syseleven.net.json
netbox_syncer  | 2022-12-05 12:11:41,620 - INFO: Created new power port object: Power Supply 1 (231V AC)
netbox_syncer  | 2022-12-05 12:11:41,620 - INFO: Created new power port object: Power Supply 2 (231V AC)
netbox_syncer  | Traceback (most recent call last):
netbox_syncer  |   File "/scripts/netbox-sync/./netbox-sync.py", line 153, in <module>
netbox_syncer  |     main()
netbox_syncer  |   File "/scripts/netbox-sync/./netbox-sync.py", line 121, in main
netbox_syncer  |     source.apply()
netbox_syncer  |   File "/scripts/netbox-sync/module/sources/check_redfish/import_inventory.py", line 242, in apply
netbox_syncer  |     self.update_network_interface()
netbox_syncer  |   File "/scripts/netbox-sync/module/sources/check_redfish/import_inventory.py", line 863, in update_network_interface
netbox_syncer  |     excluded_subnets=self.excluded_subnets, interface_name=port_name) is False:
netbox_syncer  | AttributeError: 'CheckRedfish' object has no attribute 'excluded_subnets'. Did you mean: 'permitted_subnets'?
netbox_syncer exited with code 1

@bb-Ricardo
Copy link
Owner Author

Hi, did you pull the latest container or did you build a new container from the source and used this one?

@Eldiabolo21
Copy link

Eldiabolo21 commented Dec 5, 2022

Built a new container from source. Dockerfile looks like this:
RUN git clone -b development --single-branch https://github.com/bb-Ricardo/netbox-sync.git && \ cd netbox-sync && pip3 install -r ./requirements.txt

Edit:
Because the Container also contains the check_redfish, I built my own container.

@bb-Ricardo
Copy link
Owner Author

mmhhh, I pushed another commit. Could you try this one again? thank you

@Eldiabolo21
Copy link

Eldiabolo21 commented Dec 5, 2022

wheee 👍 , works this time. Thanks so much!

One thing I noticed and where i'm not sure if this is related to the code changes in this issue or if it is something independent:
The PSUs now get created with the current Input-Voltage, which looks really weird and creates lots of different PSUs:

netbox_syncer  | 2022-12-05 23:07:58,728 - INFO: Created new power port object: Power Supply 1 (229V AC)
netbox_syncer  | 2022-12-05 23:07:58,728 - INFO: Created new power port object: Power Supply 2 (229V AC)
[...]
netbox_syncer  | 2022-12-05 23:07:59,052 - INFO: Created new power port object: Power Supply 1 (228V AC)
netbox_syncer  | 2022-12-05 23:07:59,052 - INFO: Created new power port object: Power Supply 2 (230V AC)
[...]
netbox_syncer  | 2022-12-05 23:07:59,374 - INFO: Created new power port object: Power Supply 1 (229V AC)
netbox_syncer  | 2022-12-05 23:07:59,374 - INFO: Created new power port object: Power Supply 2 (231V AC)
[...]
netbox_syncer  | 2022-12-05 23:07:59,689 - INFO: Created new power port object: Power Supply 1 (232V AC)
netbox_syncer  | 2022-12-05 23:07:59,689 - INFO: Created new power port object: Power Supply 2 (227V AC)

@bb-Ricardo
Copy link
Owner Author

Great to hear.

Will have a look into ps naming tomorrow.

@bb-Ricardo
Copy link
Owner Author

Hi @Eldiabolo21,

took a bit longer then just a day. I just pushed a commit to "development". Can you test it out?

Thank you

andreiKuznets0v pushed a commit to andreiKuznets0v/netbox-sync_try_vcloud that referenced this issue Feb 27, 2023
andreiKuznets0v pushed a commit to andreiKuznets0v/netbox-sync_try_vcloud that referenced this issue Oct 9, 2024
andreiKuznets0v pushed a commit to andreiKuznets0v/netbox-sync_try_vcloud that referenced this issue Oct 9, 2024
andreiKuznets0v pushed a commit to andreiKuznets0v/netbox-sync_try_vcloud that referenced this issue Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants