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

"Exception: Invalid policy: Invalid classMapRef" when importing policies #14

Open
sethbeauchamp opened this issue Jan 10, 2020 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@sethbeauchamp
Copy link

When importing policies into a fresh vmanage I am getting error "Exception: Invalid policy: Invalid classMapRef ".

I exported policies from an existing vmanage, then immediatley try to import that policy to another vmanage. �Both are running 19.2.1. I can provide the json file to someone privately if needed.

Traceback (most recent call last): File "/Users/seth/Desktop/SDWAN_PE_Build/bin/vmanage", line 11, in <module> load_entry_point('viptela', 'console_scripts', 'vmanage')() File "/Users/seth/Desktop/SDWAN_PE_Build/lib/python3.7/site-packages/click/core.py", line 764, in __call__ return self.main(*args, **kwargs) File "/Users/seth/Desktop/SDWAN_PE_Build/lib/python3.7/site-packages/click/core.py", line 717, in main rv = self.invoke(ctx) File "/Users/seth/Desktop/SDWAN_PE_Build/lib/python3.7/site-packages/click/core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/Users/seth/Desktop/SDWAN_PE_Build/lib/python3.7/site-packages/click/core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/Users/seth/Desktop/SDWAN_PE_Build/lib/python3.7/site-packages/click/core.py", line 956, in invoke return ctx.invoke(self.callback, **ctx.params) File "/Users/seth/Desktop/SDWAN_PE_Build/lib/python3.7/site-packages/click/core.py", line 555, in invoke return callback(*args, **kwargs) File "/Users/seth/Desktop/SDWAN_PE_Build/lib/python3.7/site-packages/click/decorators.py", line 17, in new_func return f(get_current_context(), *args, **kwargs) File "/Users/seth/Desktop/SDWAN_PE_Build/python-viptela/vmanage/cli/import_cmd/policies.py", line 24, in policies result = vmanage_session.import_policy_from_file(file, update=update, check_mode=check, push=push) File "/Users/seth/Desktop/SDWAN_PE_Build/python-viptela/vmanage/api.py", line 829, in import_policy_from_file diff = self.import_policy_definition(definition, check_mode=check_mode, update=update, push=push) File "/Users/seth/Desktop/SDWAN_PE_Build/python-viptela/vmanage/api.py", line 938, in import_policy_definition method='POST', payload=payload) File "/Users/seth/Desktop/SDWAN_PE_Build/python-viptela/vmanage/api.py", line 122, in request raise Exception('{0}: {1}'.format(error, details)) Exception: Invalid policy: Invalid classMapRef 1f15b42a-bfd3-4018-bcd7-9db1bfeb7ad9

@sethbeauchamp
Copy link
Author

I believe when importing "vmanage_policy_lists", vmanage isn't preserving the "listId" of the classmap as listed in the json file.

I separated the "vmanage_policy_lists" to import it separately into vmanage, them immediately export it and can see that the"listID" is not the same as the original json file. So when it starts to import "vmanage_policy_definitions" the "classMapRef" is no longer references a valid id.

@mike-pfeiffer mike-pfeiffer added the bug Something isn't working label Jan 12, 2020
@mike-pfeiffer
Copy link

Thanks for the find @sethbeauchamp Added to our project plan and someone will get assigned to look at it.

@stevenca
Copy link
Contributor

@sethbeauchamp, any chance that we can get a sample import file?

@sethbeauchamp
Copy link
Author

@stevenca See the files and screenshot below. The two text files need to be changed to ".json", github would not let me upload that file format so I changed it to .txt.

The file "policy.txt" is the full policy exported from another vmanage and exhibits the issue when importing.
The file "modified-policy.txt" is a file where I have removed the problematic portion, which allows it to be imported into another vmanage.

I tested this by spinning up the SD-WAN sandbox in devnet, upgrading vmanage to 19.2.1, then using the tool to import the policies. See the screenshot for the commands ran and the results.

policy.txt

modified-policy.txt

Screen Shot 2020-04-16 at 5 26 11 PM

@stevenca
Copy link
Contributor

stevenca commented May 5, 2020

The fundamental problem is that we are not processing class maps. I need to get a vmanage setup with them so that I can process. I might be able to use your policy to re-create.

@stevenca stevenca self-assigned this May 5, 2020
@sethbeauchamp
Copy link
Author

Let me know if there is something else I can provide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants