Skip to content

[MultiDB] Add multidb support to sonic-ztp#16

Merged
qiluo-msft merged 13 commits intosonic-net:masterfrom
rajendra-dendukuri:multidb_ztp_cleanup
Sep 23, 2020
Merged

[MultiDB] Add multidb support to sonic-ztp#16
qiluo-msft merged 13 commits intosonic-net:masterfrom
rajendra-dendukuri:multidb_ztp_cleanup

Conversation

@rajendra-dendukuri
Copy link
Copy Markdown
Collaborator

No description provided.

@rajendra-dendukuri
Copy link
Copy Markdown
Collaborator Author

retest buster please

else
# Remove ZTP configuration from config-db
redis-cli -n 4 DEL "ZTP|mode"
sonic-db-cli CONFIG_DB DEL "ZTP|mode"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May need to direct to /dev/null to avoid sonic-ztp[xxx]: 1 in syslog

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I fixed it.

Signed-off-by: Rajendra Dendukuri <rajendra.dendukuri@broadcom.com>
Signed-off-by: Rajendra Dendukuri <rajendra.dendukuri@broadcom.com>
@lguohan
Copy link
Copy Markdown
Contributor

lguohan commented Jun 25, 2020

retest this please

Joe LeVeque and others added 4 commits August 7, 2020 00:02
`sonic_installer` has been renamed `sonic-installer`. Update the file name everywhere it is used.
…cal/bin/ (sonic-net#19)

Update paths to reflect new sonic-utilities install location. As of PR sonic-net/sonic-utilities#1122, sonic-utilities is built and installed as a Python Wheel package. As such, the installation directory of the scripts/entrypoints has changed from `/usr/bin/` to `/usr/local/bin`. This patch updates all references to the old location to either reference the new location, or remove the absolute path entirely, where applicable.
@lguohan lguohan requested a review from qiluo-msft September 20, 2020 17:47
self.__input_file = input_file

self.configDB = ConfigDBConnector()
if self.configDB is None:
Copy link
Copy Markdown
Contributor

@qiluo-msft qiluo-msft Sep 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.configDB [](start = 11, length = 13)

Could you clarify when it is None? #Closed

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in latest commit

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new code seems worse. Why construct ConfigDBConnector twice?


In reply to: 492363061 [](ancestors = 492363061)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad. I did not resolve the merge conflict properly and ended up having two copies of the code. I fixed it now.

updateActivity('configdb-json: Removing ZTP configuation from Config DB')
logger.info('configdb-json: Configuration change detected. Removing ZTP configuation from Config DB.')
runCommand('redis-cli -n 4 DEL "ZTP|mode"', capture_stdout=False)
self.configDB.delete_table("ZTP")
Copy link
Copy Markdown
Contributor

@qiluo-msft qiluo-msft Sep 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete_table [](start = 30, length = 12)

Original code is deleting a entry, and new code is deleting a table. Is it expected? #Closed

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in latest commit

cmd = "/bin/sed -i -e 's/\"mac\": \".*\"/\"mac\": \"invalid2\"/' " + str(fh_after)
rc = runCommand(cmd)
cmd = "/bin/sed -i -e 's/\"hwsku\": \".*\"/\"hwsku\": \"invalid3\"/' " + str(fh_after)
rc = runCommand(cmd)
Copy link
Copy Markdown
Contributor

@qiluo-msft qiluo-msft Sep 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you just parse config-before.json, modify in memory and write to config-after.json? #Closed

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in latest commit

cmd = "/bin/sed -i -e 's/\"mac\": \".*\"/\"mac\": \"invalid2\"/' " + str(fh_after)
rc = runCommand(cmd)
cmd = "/bin/sed -i -e 's/\"hwsku\": \".*\"/\"hwsku\": \"" + hwsku + "_dup" +"\"/' " + str(fh_after)
rc = runCommand(cmd)
Copy link
Copy Markdown
Contributor

@qiluo-msft qiluo-msft Sep 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same #Closed

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in latest commit

def __link_scan(self):
## Redis DB connectors
configDB = None
applDB = None
Copy link
Copy Markdown
Contributor

@qiluo-msft qiluo-msft Sep 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mixed using Class Variables and Instance Variables. Please check some tutorial, such as https://careerkarma.com/blog/python-class-variables/ #Closed

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in latest commit

Copy link
Copy Markdown
Contributor

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As comments

@qiluo-msft
Copy link
Copy Markdown
Contributor

@dzhangalibaba Could you also help review this PR?

Copy link
Copy Markdown
Contributor

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Please also resolve other reviewers' comments.

# Connect to AppDB
try:
if self.applDB is None:
self.applDB = SonicV2Connector(host='127.0.0.1')
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove "host='127.0.0.1' " , it is not needed , all info should come from database_config.json and the host here didn't take effect.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented the recommended change.

@qiluo-msft qiluo-msft merged commit 6f0305b into sonic-net:master Sep 23, 2020
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.

6 participants