Skip to content

Add SonicV2Connector::set method for int value.#648

Merged
liuh-80 merged 7 commits intosonic-net:masterfrom
liuh-80:dev/liuh/fix-compatibility-issue
Jul 13, 2022
Merged

Add SonicV2Connector::set method for int value.#648
liuh-80 merged 7 commits intosonic-net:masterfrom
liuh-80:dev/liuh/fix-compatibility-issue

Conversation

@liuh-80
Copy link
Copy Markdown
Contributor

@liuh-80 liuh-80 commented Jul 11, 2022

Why I did it

Following config command in sonic-utility using an API does not exist in swss-common:

sudo config rate smoothing-interval 100

https://github.com/Azure/sonic-utilities/blob/e089b964ef0d38d8c691eb3e551e479c0c68dd96/config/main.py#L6548
counters_db.set('COUNTERS_DB', 'RATES:PORT', 'PORT_SMOOTH_INTERVAL', interval) <== interval is an int value.

Currently swss-common only support string value:
int64_t SonicV2Connector_Native::set(const std::string& db_name, const std::string& _hash, const std::string& key, const std::string& val, bool blocking)

How I did it

Add SonicV2Connector::set method for int value.

How to verify it

Pass all test case.
Add UT to cover new API.

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111

Description for the changelog

Add SonicV2Connector::set method for int value.

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

@liuh-80
Copy link
Copy Markdown
Contributor Author

liuh-80 commented Jul 11, 2022

Another PR depends on this change: sonic-net/sonic-utilities#2251

@liuh-80 liuh-80 requested a review from qiluo-msft July 11, 2022 08:58
@liuh-80 liuh-80 marked this pull request as ready for review July 11, 2022 08:58
@liuh-80
Copy link
Copy Markdown
Contributor Author

liuh-80 commented Jul 11, 2022

This PR need improve, because following error:

NotImplementedError: Wrong number or type of arguments for overloaded function 'SonicV2Connector_Native_set'.
Possible C/C++ prototypes are:
swss::SonicV2Connector_Native::set(std::string const &,std::string const &,std::string const &,std::string const &,bool)
swss::SonicV2Connector_Native::set(std::string const &,std::string const &,std::string const &,int const,bool)

@liuh-80
Copy link
Copy Markdown
Contributor Author

liuh-80 commented Jul 11, 2022

This PR need improve, because following error:

NotImplementedError: Wrong number or type of arguments for overloaded function 'SonicV2Connector_Native_set'. Possible C/C++ prototypes are: swss::SonicV2Connector_Native::set(std::string const &,std::string const &,std::string const &,std::string const &,bool) swss::SonicV2Connector_Native::set(std::string const &,std::string const &,std::string const &,int const,bool)

This PR need improve, because following error:

NotImplementedError: Wrong number or type of arguments for overloaded function 'SonicV2Connector_Native_set'. Possible C/C++ prototypes are: swss::SonicV2Connector_Native::set(std::string const &,std::string const &,std::string const &,std::string const &,bool) swss::SonicV2Connector_Native::set(std::string const &,std::string const &,std::string const &,int const,bool)

Fixed by using python method.

@liuh-80
Copy link
Copy Markdown
Contributor Author

liuh-80 commented Jul 12, 2022

Build sai redis failed because UT failed, all build failed after sunday, so not related with this PR. will keep retry and merge after it passed.

@liuh-80
Copy link
Copy Markdown
Contributor Author

liuh-80 commented Jul 12, 2022

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@liuh-80 liuh-80 merged commit 7e39f31 into sonic-net:master Jul 13, 2022
itamar-talmon pushed a commit to itamar-talmon/sonic-swss-common that referenced this pull request Jul 19, 2022
#### Why I did it
Following config command in sonic-utility using an API does not exist in swss-common:

sudo config rate smoothing-interval 100

https://github.com/Azure/sonic-utilities/blob/e089b964ef0d38d8c691eb3e551e479c0c68dd96/config/main.py#L6548
counters_db.set('COUNTERS_DB', 'RATES:PORT', 'PORT_SMOOTH_INTERVAL', interval) <== interval is an int value.

Currently swss-common only support string value:
int64_t SonicV2Connector_Native::set(const std::string& db_name, const std::string& _hash, const std::string& key, const std::string& val, bool blocking)


#### How I did it
Add SonicV2Connector::set method for int value.

#### How to verify it
Pass all test case.
Add UT to cover new API.

#### Which release branch to backport (provide reason below if selected)

<!--
- Note we only backport fixes to a release branch, *not* features!
- Please also provide a reason for the backporting below.
- e.g.
- [x] 202006
-->

- [ ] 201811
- [ ] 201911
- [ ] 202006
- [ ] 202012
- [ ] 202106
- [ ] 202111

#### Description for the changelog
Add SonicV2Connector::set method for int value.

#### Link to config_db schema for YANG module changes

#### A picture of a cute animal (not mandatory but encouraged)
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

Successfully merging this pull request may close these issues.

2 participants