From d238f99544ad1e09dccbaf9d4051b128b7678cf2 Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Fri, 9 Jun 2023 01:15:20 +0000 Subject: automatic import of python-cisco-sdwan --- .gitignore | 1 + python-cisco-sdwan.spec | 579 ++++++++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 581 insertions(+) create mode 100644 python-cisco-sdwan.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..f2bcb0d 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/cisco_sdwan-1.21.2.tar.gz diff --git a/python-cisco-sdwan.spec b/python-cisco-sdwan.spec new file mode 100644 index 0000000..19e2d5a --- /dev/null +++ b/python-cisco-sdwan.spec @@ -0,0 +1,579 @@ +%global _empty_manifest_terminate_build 0 +Name: python-cisco-sdwan +Version: 1.21.2 +Release: 1 +Summary: Cisco-SDWAN Automation Toolset +License: MIT License Copyright (c) 2019 Cisco Systems, Inc. and/or its affiliates Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +URL: https://github.com/CiscoDevNet/sastre +Source0: https://mirrors.aliyun.com/pypi/web/packages/c5/12/7950d3b53eb4c8106a7531729500f8c0da8b76abe173ac548340bccd7c0e/cisco_sdwan-1.21.2.tar.gz +BuildArch: noarch + +Requires: python3-pydantic +Requires: python3-pyyaml +Requires: python3-requests + +%description +tag: template_feature +name_template: + regex: "^All-" + name_regex: "{name ^All-(.+)}" +name_map: + DC1-VPN10-Interface-Template: DC-VPN10-Interface_v01 + DC1-VPN20-Interface-Template: DC-VPN20-Interface_v01 +% sdwan --verbose transform recipe --from-file recipe.yaml test-transform +INFO: Transform task: vManage URL: "https://198.18.1.10" -> Local output dir: "test-transform" +<< snip >> +INFO: Matched feature template All-VPN0-TEMPLATE_cEdge +INFO: Replacing feature template: All-VPN0-TEMPLATE_cEdge -> VPN0-TEMPLATE_cEdge +INFO: Inspecting template_device items +INFO: Task completed successfully +``` +Push changes to vManage using the restore task: +``` +% sdwan --verbose restore all --workdir test-transform --update +INFO: Restore task: Local workdir: "test-transform" -> vManage URL: "https://198.18.1.10" +<< snip >> +INFO: Task completed successfully +``` +## Notes +### Regular Expressions +It is recommended to always use single quotes when specifying a regular expression to --regex option: +``` +sdwan --verbose restore all --regex 'VPN1' +``` +This is to prevent the shell from interpreting special characters that could be part of the pattern provided. +Matching done by --regex is un-anchored. That is, unless anchor marks are provided (e.g. ^ or $), the specified pattern matches if present anywhere in the string. In other words, this is a search function. +The regular expression syntax supported is described in https://docs.python.org/3/library/re.html +#### Behavior of --regex and --not-regex: +- --regex is used to select items to include (i.e. perform task operation) +- --not-regex is used to define items not to include. That is, select all items, except the ones matching --not-regex. +- When --regex match on multiple fields (e.g. item name, item ID), an item is selected if the item name OR item ID match the regular expression provided. +- With --not-regex, when it matches on multiple fields (e.g. item name, item ID), all items are selected, except the ones where item name OR item ID match the regular expression. +### Template name manipulation via name-regex +Multiple Sastre tasks utilize name-regex for name manipulation: +- Migrate task --name option accepts a name-regex. +- Transform copy/rename tasks have a `` mandatory parameter. +- Transform recipe task allow `name_regex` under `name_template` section of the recipe YAML file. +- The 'list transform' task also take a `` parameter. This task was designed to facilitate testing of those expressions. +A name-regex is a template for creating a new name based on segments of an original name. +The following rules apply: +- Occurrences of {name} are replaced with the original item name. +- Sections of the original item name can be captured by providing a regular expression in the format: {name <regex>}. This regular expression must contain one or more capturing groups, which define segments of the original name to "copy". Segments matching each capturing group are concatenated and "pasted" to the {name} position. +- If the regular expression does not match, {name <regex>} is replaced with an empty string. +Example: +``` +Consider the template name "G_Branch_184_Single_cE4451-X_2xWAN_DHCP_L2_v01". +In order to get the migrated name as "G_Branch_201_Single_cE4451-X_2xWAN_DHCP_L2_v01", one can use --name '{name (G_.+)_184_.+}_201_{name G.+_184_(.+)}'. +% sdwan list transform template_device --regex 'G_Branch_184_Single_cE4451' --workdir sastre_cx_golden_repo '{name (G_.+)_184_.+}_201_{name G.+_184_(.+)}' ++===================================================================================================================================================================+ +| Name | Transformed | Tag | Type | ++===================================================================================================================================================================+ +| G_Branch_184_Single_cE4451-X_2xWAN_Static_2xSLAN_Trunk_L2_v01 | G_Branch_201_Single_cE4451-X_2xWAN_Static_2xSLAN_Trunk_L2_v01 | template_device | device template | +| G_Branch_184_Single_cE4451-X_2xWAN_DHCP_L2_v01 | G_Branch_201_Single_cE4451-X_2xWAN_DHCP_L2_v01 | template_device | device template | ++---------------------------------------------------------------+---------------------------------------------------------------+-----------------+-----------------+ +``` +### Logs +Sastre logs messages to the terminal and to log files (under the logs/ directory). +Debug-level and higher severity messages are always saved to the log files. +The --verbose flag controls the severity of messages printed to the terminal. If --verbose is not specified, only warning-level and higher messages are logged. When --verbose is specified, informational-level and higher messages are printed. +### Restore behavior +By default, restore will skip items with the same name. If an existing item on vManage has the same name as an item in the backup this item is skipped from restore. +Any references/dependencies on that item are properly updated. For instance, if a feature template is not pushed to vManage because an item with the same name is already present, device templates being pushed will now point to the feature template which is already on vManage. +**Restore with --update:** +Adding the --update option to restore modifies this behavior. In this case, Sastre will update existing items containing the same name as in the backup, but only if their content is different. +When an existing vManage item is modified, device templates may need to be reattached or vSmart policies may need to be re-activated. This is handled as follows: +- Updating items associated with an active vSmart policy may require this policy to be re-activated. In this case, Sastre will request the policy reactivate automatically. +- On updates to master templates (e.g. device template) containing attached devices, Sastre will re-attach the device templates. +- On Updates to child templates (e.g. feature template) associated with master templates containing attached devices, Sastre will re-attach the affected master template(s). +- In all re-attach cases, Sastre will use the existing attachment values on vManage to feed the attach request. +The implication is that if modified templates define new variables re-attach will fail, because not all variables would have values assigned. In this case, the recommended procedure is to detach the master template (e.g. using detach task), re-run "restore --update", then re-attach the device-template from vManage, where one would be able to supply any missing variable values. +**Factory default items:** +If a factory-default item in the backup is a dependency (referenced by other items) that is missing on the target vManage, it is converted to a non-default item and pushed to vManage. +A WARNING message is displayed when this condition happens. The user may want to review the corresponding templates/policies and update them to reference newer versions or equivalent factory-defaults that may be available on vManage. +## Installing +Sastre requires Python 3.8 or newer. This can be verified by pasting the following to a terminal window: +``` +% python3 -c "import sys;assert sys.version_info>(3,8)" && echo "ALL GOOD" +``` +If 'ALL GOOD' is printed it means Python requirements are met. If not, download and install the latest 3.x version at Python.org (https://www.python.org/downloads/). +The recommended way to install Sastre is via pip. For development purposes, Sastre can be installed from the GitHub repository. Both methods are described in this section. +### PIP install in a virtual environment (recommended) +Create a directory to store the virtual environment and runtime files: +``` +% mkdir sastre +% cd sastre +``` +Create virtual environment: +``` +% python3 -m venv venv +``` +Activate virtual environment: +``` +% source venv/bin/activate +(venv) % +``` +- Note that the prompt is updated with the virtual environment name (venv), indicating that the virtual environment is active. +Upgrade initial virtual environment packages: +``` +(venv) % pip install --upgrade pip setuptools +``` +Install Sastre: +``` +(venv) % pip install --upgrade cisco-sdwan +``` +Verify that Sastre can run: +``` +(venv) % sdwan --version +``` +Notes: +- The virtual environment is deactivated by typing 'deactivate' at the command prompt. +- Before running Sastre, make sure to activate the virtual environment back again (source venv/bin/activate). +### PIP install +With this option you will likely need to run the pip commands as sudo. +Install Sastre: +``` +% python3 -m pip install --upgrade cisco-sdwan +``` +Verify that Sastre can run: +``` +% sdwan --version +``` +### GitHub install +Clone from the GitHub repository: +``` +% git clone https://github.com/CiscoDevNet/sastre +``` +Move to the clone directory: +``` +% cd sastre +``` +Create virtual environment: +``` +% python3 -m venv venv +``` +Activate virtual environment: +``` +% source venv/bin/activate +(venv) % +``` +- Note that the prompt is updated with the virtual environment name (venv), indicating that the virtual environment is active. +Upgrade initial virtual environment packages: +``` +(venv) % pip install --upgrade pip setuptools +``` +Install required Python packages: +``` +(venv) % pip install -r requirements.txt +``` +Verify that Sastre can run: +``` +(venv) % python3 sdwan.py --version +``` +### Docker install +First, proceed with the [GitHub install](#GitHub-install) outlined above. +Ensure you are within the directory cloned from GitHub: +``` +% cd sastre +``` +Then proceed as follows to build the docker container: +``` +% docker build -t sastre . +Sending build context to Docker daemon 220MB +Step 1/12 : ARG http_proxy +Step 2/12 : ARG https_proxy +Step 3/12 : ARG no_proxy + +%package -n python3-cisco-sdwan +Summary: Cisco-SDWAN Automation Toolset +Provides: python-cisco-sdwan +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-cisco-sdwan +tag: template_feature +name_template: + regex: "^All-" + name_regex: "{name ^All-(.+)}" +name_map: + DC1-VPN10-Interface-Template: DC-VPN10-Interface_v01 + DC1-VPN20-Interface-Template: DC-VPN20-Interface_v01 +% sdwan --verbose transform recipe --from-file recipe.yaml test-transform +INFO: Transform task: vManage URL: "https://198.18.1.10" -> Local output dir: "test-transform" +<< snip >> +INFO: Matched feature template All-VPN0-TEMPLATE_cEdge +INFO: Replacing feature template: All-VPN0-TEMPLATE_cEdge -> VPN0-TEMPLATE_cEdge +INFO: Inspecting template_device items +INFO: Task completed successfully +``` +Push changes to vManage using the restore task: +``` +% sdwan --verbose restore all --workdir test-transform --update +INFO: Restore task: Local workdir: "test-transform" -> vManage URL: "https://198.18.1.10" +<< snip >> +INFO: Task completed successfully +``` +## Notes +### Regular Expressions +It is recommended to always use single quotes when specifying a regular expression to --regex option: +``` +sdwan --verbose restore all --regex 'VPN1' +``` +This is to prevent the shell from interpreting special characters that could be part of the pattern provided. +Matching done by --regex is un-anchored. That is, unless anchor marks are provided (e.g. ^ or $), the specified pattern matches if present anywhere in the string. In other words, this is a search function. +The regular expression syntax supported is described in https://docs.python.org/3/library/re.html +#### Behavior of --regex and --not-regex: +- --regex is used to select items to include (i.e. perform task operation) +- --not-regex is used to define items not to include. That is, select all items, except the ones matching --not-regex. +- When --regex match on multiple fields (e.g. item name, item ID), an item is selected if the item name OR item ID match the regular expression provided. +- With --not-regex, when it matches on multiple fields (e.g. item name, item ID), all items are selected, except the ones where item name OR item ID match the regular expression. +### Template name manipulation via name-regex +Multiple Sastre tasks utilize name-regex for name manipulation: +- Migrate task --name option accepts a name-regex. +- Transform copy/rename tasks have a `` mandatory parameter. +- Transform recipe task allow `name_regex` under `name_template` section of the recipe YAML file. +- The 'list transform' task also take a `` parameter. This task was designed to facilitate testing of those expressions. +A name-regex is a template for creating a new name based on segments of an original name. +The following rules apply: +- Occurrences of {name} are replaced with the original item name. +- Sections of the original item name can be captured by providing a regular expression in the format: {name <regex>}. This regular expression must contain one or more capturing groups, which define segments of the original name to "copy". Segments matching each capturing group are concatenated and "pasted" to the {name} position. +- If the regular expression does not match, {name <regex>} is replaced with an empty string. +Example: +``` +Consider the template name "G_Branch_184_Single_cE4451-X_2xWAN_DHCP_L2_v01". +In order to get the migrated name as "G_Branch_201_Single_cE4451-X_2xWAN_DHCP_L2_v01", one can use --name '{name (G_.+)_184_.+}_201_{name G.+_184_(.+)}'. +% sdwan list transform template_device --regex 'G_Branch_184_Single_cE4451' --workdir sastre_cx_golden_repo '{name (G_.+)_184_.+}_201_{name G.+_184_(.+)}' ++===================================================================================================================================================================+ +| Name | Transformed | Tag | Type | ++===================================================================================================================================================================+ +| G_Branch_184_Single_cE4451-X_2xWAN_Static_2xSLAN_Trunk_L2_v01 | G_Branch_201_Single_cE4451-X_2xWAN_Static_2xSLAN_Trunk_L2_v01 | template_device | device template | +| G_Branch_184_Single_cE4451-X_2xWAN_DHCP_L2_v01 | G_Branch_201_Single_cE4451-X_2xWAN_DHCP_L2_v01 | template_device | device template | ++---------------------------------------------------------------+---------------------------------------------------------------+-----------------+-----------------+ +``` +### Logs +Sastre logs messages to the terminal and to log files (under the logs/ directory). +Debug-level and higher severity messages are always saved to the log files. +The --verbose flag controls the severity of messages printed to the terminal. If --verbose is not specified, only warning-level and higher messages are logged. When --verbose is specified, informational-level and higher messages are printed. +### Restore behavior +By default, restore will skip items with the same name. If an existing item on vManage has the same name as an item in the backup this item is skipped from restore. +Any references/dependencies on that item are properly updated. For instance, if a feature template is not pushed to vManage because an item with the same name is already present, device templates being pushed will now point to the feature template which is already on vManage. +**Restore with --update:** +Adding the --update option to restore modifies this behavior. In this case, Sastre will update existing items containing the same name as in the backup, but only if their content is different. +When an existing vManage item is modified, device templates may need to be reattached or vSmart policies may need to be re-activated. This is handled as follows: +- Updating items associated with an active vSmart policy may require this policy to be re-activated. In this case, Sastre will request the policy reactivate automatically. +- On updates to master templates (e.g. device template) containing attached devices, Sastre will re-attach the device templates. +- On Updates to child templates (e.g. feature template) associated with master templates containing attached devices, Sastre will re-attach the affected master template(s). +- In all re-attach cases, Sastre will use the existing attachment values on vManage to feed the attach request. +The implication is that if modified templates define new variables re-attach will fail, because not all variables would have values assigned. In this case, the recommended procedure is to detach the master template (e.g. using detach task), re-run "restore --update", then re-attach the device-template from vManage, where one would be able to supply any missing variable values. +**Factory default items:** +If a factory-default item in the backup is a dependency (referenced by other items) that is missing on the target vManage, it is converted to a non-default item and pushed to vManage. +A WARNING message is displayed when this condition happens. The user may want to review the corresponding templates/policies and update them to reference newer versions or equivalent factory-defaults that may be available on vManage. +## Installing +Sastre requires Python 3.8 or newer. This can be verified by pasting the following to a terminal window: +``` +% python3 -c "import sys;assert sys.version_info>(3,8)" && echo "ALL GOOD" +``` +If 'ALL GOOD' is printed it means Python requirements are met. If not, download and install the latest 3.x version at Python.org (https://www.python.org/downloads/). +The recommended way to install Sastre is via pip. For development purposes, Sastre can be installed from the GitHub repository. Both methods are described in this section. +### PIP install in a virtual environment (recommended) +Create a directory to store the virtual environment and runtime files: +``` +% mkdir sastre +% cd sastre +``` +Create virtual environment: +``` +% python3 -m venv venv +``` +Activate virtual environment: +``` +% source venv/bin/activate +(venv) % +``` +- Note that the prompt is updated with the virtual environment name (venv), indicating that the virtual environment is active. +Upgrade initial virtual environment packages: +``` +(venv) % pip install --upgrade pip setuptools +``` +Install Sastre: +``` +(venv) % pip install --upgrade cisco-sdwan +``` +Verify that Sastre can run: +``` +(venv) % sdwan --version +``` +Notes: +- The virtual environment is deactivated by typing 'deactivate' at the command prompt. +- Before running Sastre, make sure to activate the virtual environment back again (source venv/bin/activate). +### PIP install +With this option you will likely need to run the pip commands as sudo. +Install Sastre: +``` +% python3 -m pip install --upgrade cisco-sdwan +``` +Verify that Sastre can run: +``` +% sdwan --version +``` +### GitHub install +Clone from the GitHub repository: +``` +% git clone https://github.com/CiscoDevNet/sastre +``` +Move to the clone directory: +``` +% cd sastre +``` +Create virtual environment: +``` +% python3 -m venv venv +``` +Activate virtual environment: +``` +% source venv/bin/activate +(venv) % +``` +- Note that the prompt is updated with the virtual environment name (venv), indicating that the virtual environment is active. +Upgrade initial virtual environment packages: +``` +(venv) % pip install --upgrade pip setuptools +``` +Install required Python packages: +``` +(venv) % pip install -r requirements.txt +``` +Verify that Sastre can run: +``` +(venv) % python3 sdwan.py --version +``` +### Docker install +First, proceed with the [GitHub install](#GitHub-install) outlined above. +Ensure you are within the directory cloned from GitHub: +``` +% cd sastre +``` +Then proceed as follows to build the docker container: +``` +% docker build -t sastre . +Sending build context to Docker daemon 220MB +Step 1/12 : ARG http_proxy +Step 2/12 : ARG https_proxy +Step 3/12 : ARG no_proxy + +%package help +Summary: Development documents and examples for cisco-sdwan +Provides: python3-cisco-sdwan-doc +%description help +tag: template_feature +name_template: + regex: "^All-" + name_regex: "{name ^All-(.+)}" +name_map: + DC1-VPN10-Interface-Template: DC-VPN10-Interface_v01 + DC1-VPN20-Interface-Template: DC-VPN20-Interface_v01 +% sdwan --verbose transform recipe --from-file recipe.yaml test-transform +INFO: Transform task: vManage URL: "https://198.18.1.10" -> Local output dir: "test-transform" +<< snip >> +INFO: Matched feature template All-VPN0-TEMPLATE_cEdge +INFO: Replacing feature template: All-VPN0-TEMPLATE_cEdge -> VPN0-TEMPLATE_cEdge +INFO: Inspecting template_device items +INFO: Task completed successfully +``` +Push changes to vManage using the restore task: +``` +% sdwan --verbose restore all --workdir test-transform --update +INFO: Restore task: Local workdir: "test-transform" -> vManage URL: "https://198.18.1.10" +<< snip >> +INFO: Task completed successfully +``` +## Notes +### Regular Expressions +It is recommended to always use single quotes when specifying a regular expression to --regex option: +``` +sdwan --verbose restore all --regex 'VPN1' +``` +This is to prevent the shell from interpreting special characters that could be part of the pattern provided. +Matching done by --regex is un-anchored. That is, unless anchor marks are provided (e.g. ^ or $), the specified pattern matches if present anywhere in the string. In other words, this is a search function. +The regular expression syntax supported is described in https://docs.python.org/3/library/re.html +#### Behavior of --regex and --not-regex: +- --regex is used to select items to include (i.e. perform task operation) +- --not-regex is used to define items not to include. That is, select all items, except the ones matching --not-regex. +- When --regex match on multiple fields (e.g. item name, item ID), an item is selected if the item name OR item ID match the regular expression provided. +- With --not-regex, when it matches on multiple fields (e.g. item name, item ID), all items are selected, except the ones where item name OR item ID match the regular expression. +### Template name manipulation via name-regex +Multiple Sastre tasks utilize name-regex for name manipulation: +- Migrate task --name option accepts a name-regex. +- Transform copy/rename tasks have a `` mandatory parameter. +- Transform recipe task allow `name_regex` under `name_template` section of the recipe YAML file. +- The 'list transform' task also take a `` parameter. This task was designed to facilitate testing of those expressions. +A name-regex is a template for creating a new name based on segments of an original name. +The following rules apply: +- Occurrences of {name} are replaced with the original item name. +- Sections of the original item name can be captured by providing a regular expression in the format: {name <regex>}. This regular expression must contain one or more capturing groups, which define segments of the original name to "copy". Segments matching each capturing group are concatenated and "pasted" to the {name} position. +- If the regular expression does not match, {name <regex>} is replaced with an empty string. +Example: +``` +Consider the template name "G_Branch_184_Single_cE4451-X_2xWAN_DHCP_L2_v01". +In order to get the migrated name as "G_Branch_201_Single_cE4451-X_2xWAN_DHCP_L2_v01", one can use --name '{name (G_.+)_184_.+}_201_{name G.+_184_(.+)}'. +% sdwan list transform template_device --regex 'G_Branch_184_Single_cE4451' --workdir sastre_cx_golden_repo '{name (G_.+)_184_.+}_201_{name G.+_184_(.+)}' ++===================================================================================================================================================================+ +| Name | Transformed | Tag | Type | ++===================================================================================================================================================================+ +| G_Branch_184_Single_cE4451-X_2xWAN_Static_2xSLAN_Trunk_L2_v01 | G_Branch_201_Single_cE4451-X_2xWAN_Static_2xSLAN_Trunk_L2_v01 | template_device | device template | +| G_Branch_184_Single_cE4451-X_2xWAN_DHCP_L2_v01 | G_Branch_201_Single_cE4451-X_2xWAN_DHCP_L2_v01 | template_device | device template | ++---------------------------------------------------------------+---------------------------------------------------------------+-----------------+-----------------+ +``` +### Logs +Sastre logs messages to the terminal and to log files (under the logs/ directory). +Debug-level and higher severity messages are always saved to the log files. +The --verbose flag controls the severity of messages printed to the terminal. If --verbose is not specified, only warning-level and higher messages are logged. When --verbose is specified, informational-level and higher messages are printed. +### Restore behavior +By default, restore will skip items with the same name. If an existing item on vManage has the same name as an item in the backup this item is skipped from restore. +Any references/dependencies on that item are properly updated. For instance, if a feature template is not pushed to vManage because an item with the same name is already present, device templates being pushed will now point to the feature template which is already on vManage. +**Restore with --update:** +Adding the --update option to restore modifies this behavior. In this case, Sastre will update existing items containing the same name as in the backup, but only if their content is different. +When an existing vManage item is modified, device templates may need to be reattached or vSmart policies may need to be re-activated. This is handled as follows: +- Updating items associated with an active vSmart policy may require this policy to be re-activated. In this case, Sastre will request the policy reactivate automatically. +- On updates to master templates (e.g. device template) containing attached devices, Sastre will re-attach the device templates. +- On Updates to child templates (e.g. feature template) associated with master templates containing attached devices, Sastre will re-attach the affected master template(s). +- In all re-attach cases, Sastre will use the existing attachment values on vManage to feed the attach request. +The implication is that if modified templates define new variables re-attach will fail, because not all variables would have values assigned. In this case, the recommended procedure is to detach the master template (e.g. using detach task), re-run "restore --update", then re-attach the device-template from vManage, where one would be able to supply any missing variable values. +**Factory default items:** +If a factory-default item in the backup is a dependency (referenced by other items) that is missing on the target vManage, it is converted to a non-default item and pushed to vManage. +A WARNING message is displayed when this condition happens. The user may want to review the corresponding templates/policies and update them to reference newer versions or equivalent factory-defaults that may be available on vManage. +## Installing +Sastre requires Python 3.8 or newer. This can be verified by pasting the following to a terminal window: +``` +% python3 -c "import sys;assert sys.version_info>(3,8)" && echo "ALL GOOD" +``` +If 'ALL GOOD' is printed it means Python requirements are met. If not, download and install the latest 3.x version at Python.org (https://www.python.org/downloads/). +The recommended way to install Sastre is via pip. For development purposes, Sastre can be installed from the GitHub repository. Both methods are described in this section. +### PIP install in a virtual environment (recommended) +Create a directory to store the virtual environment and runtime files: +``` +% mkdir sastre +% cd sastre +``` +Create virtual environment: +``` +% python3 -m venv venv +``` +Activate virtual environment: +``` +% source venv/bin/activate +(venv) % +``` +- Note that the prompt is updated with the virtual environment name (venv), indicating that the virtual environment is active. +Upgrade initial virtual environment packages: +``` +(venv) % pip install --upgrade pip setuptools +``` +Install Sastre: +``` +(venv) % pip install --upgrade cisco-sdwan +``` +Verify that Sastre can run: +``` +(venv) % sdwan --version +``` +Notes: +- The virtual environment is deactivated by typing 'deactivate' at the command prompt. +- Before running Sastre, make sure to activate the virtual environment back again (source venv/bin/activate). +### PIP install +With this option you will likely need to run the pip commands as sudo. +Install Sastre: +``` +% python3 -m pip install --upgrade cisco-sdwan +``` +Verify that Sastre can run: +``` +% sdwan --version +``` +### GitHub install +Clone from the GitHub repository: +``` +% git clone https://github.com/CiscoDevNet/sastre +``` +Move to the clone directory: +``` +% cd sastre +``` +Create virtual environment: +``` +% python3 -m venv venv +``` +Activate virtual environment: +``` +% source venv/bin/activate +(venv) % +``` +- Note that the prompt is updated with the virtual environment name (venv), indicating that the virtual environment is active. +Upgrade initial virtual environment packages: +``` +(venv) % pip install --upgrade pip setuptools +``` +Install required Python packages: +``` +(venv) % pip install -r requirements.txt +``` +Verify that Sastre can run: +``` +(venv) % python3 sdwan.py --version +``` +### Docker install +First, proceed with the [GitHub install](#GitHub-install) outlined above. +Ensure you are within the directory cloned from GitHub: +``` +% cd sastre +``` +Then proceed as follows to build the docker container: +``` +% docker build -t sastre . +Sending build context to Docker daemon 220MB +Step 1/12 : ARG http_proxy +Step 2/12 : ARG https_proxy +Step 3/12 : ARG no_proxy + +%prep +%autosetup -n cisco_sdwan-1.21.2 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-cisco-sdwan -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Fri Jun 09 2023 Python_Bot - 1.21.2-1 +- Package Spec generated diff --git a/sources b/sources new file mode 100644 index 0000000..e8622c2 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +ba66660d5bd8cf5aa5ce835a0b4bec08 cisco_sdwan-1.21.2.tar.gz -- cgit v1.2.3