Skip to content

Commit 1b07d56

Browse files
authored
Merge pull request #6 from cisco-ie/development
Apply license
2 parents 9d3c0a3 + 5f7cb01 commit 1b07d56

File tree

6 files changed

+73
-15
lines changed

6 files changed

+73
-15
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright [yyyy] [name of copyright owner]
189+
Copyright 2019 Cisco Systems
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

nxos_grpc/__init__.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
"""
2-
Copyright 2018 Cisco Systems
1+
"""Copyright 2019 Cisco Systems
32
4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
76
8-
http://www.apache.org/licenses/LICENSE-2.0
7+
http://www.apache.org/licenses/LICENSE-2.0
98
10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
1514
"""
1615
from .client import Client

nxos_grpc/client.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
1+
"""Copyright 2019 Cisco Systems
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
"""
115
"""NX-OS gRPC Python wrapper library
2-
Copyright 2018 Cisco Systems
3-
Apache v2 Licensed
416
Function usage derived from example NX-OS client from Kyoung Yun. Thanks :)
517
TODO: Write session state management wrapper.
618
TODO: Make individual returns more useful?

nxos_grpc/response.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
"""Copyright 2019 Cisco Systems
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
"""
115
"""Generic response wrapper class.
216
All responses follow the same data return format,
317
so generalizing the data return structure. Formalizes
@@ -7,6 +21,7 @@
721
TODO: Simplify?
822
"""
923
import json
24+
import logging
1025

1126

1227
def build_response(reqid, response_stream):
@@ -37,7 +52,10 @@ def build_response(reqid, response_stream):
3752
response_obj = gRPCResponse(reqid)
3853
for response in response_stream:
3954
response_obj.add_data(response.ReqID, response.YangData, response.Errors)
40-
response_obj.finalize()
55+
try:
56+
response_obj.finalize()
57+
except json.decoder.JSONDecodeError:
58+
logging.exception('Error finalizing response JSON! Returning potentially un-finalized elements.')
4159
return response_obj
4260

4361

sample.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
#!/usr/bin/env python
2+
"""Copyright 2019 Cisco Systems
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
"""
216
import json
317
import logging
418
from nxos_grpc import Client

setup.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33

4+
"""Copyright 2019 Cisco Systems
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
"""
18+
419
# Adapted from https://github.com/kennethreitz/setup.py
520
# Note: To use the 'upload' functionality of this file, you must:
621
# $ pip install twine

0 commit comments

Comments
 (0)