Skip to content

Replace ifconfig with ip utils#1022

Merged
jleveque merged 1 commit intosonic-net:masterfrom
nazariig:master-ptf-ip-link
Jul 23, 2019
Merged

Replace ifconfig with ip utils#1022
jleveque merged 1 commit intosonic-net:masterfrom
nazariig:master-ptf-ip-link

Conversation

@nazariig
Copy link
Contributor

@nazariig nazariig commented Jul 21, 2019

Signed-off-by: Nazarii Hnydyn [email protected]

Description of PR

Replaced ifconfig with ip utils

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Approach

How did you do it?

Replaced ifconfig with ip utils

How did you verify/test it?

./change_mac.sh
Update eth0 MAC address: 98:03:9b:82:ba:47->98:03:9b:82:ba:00
Update eth1 MAC address: 98:03:9b:82:ba:21->98:03:9b:82:ba:01
Update eth2 MAC address: 98:03:9b:82:ba:12->98:03:9b:82:ba:02
Update eth3 MAC address: 98:03:9b:82:ba:33->98:03:9b:82:ba:03
Update eth4 MAC address: 98:03:9b:82:ba:24->98:03:9b:82:ba:04
Update eth5 MAC address: 98:03:9b:82:ba:15->98:03:9b:82:ba:05
Update eth6 MAC address: 98:03:9b:82:ba:32->98:03:9b:82:ba:06
Update eth7 MAC address: 98:03:9b:82:ba:88->98:03:9b:82:ba:07
Update eth8 MAC address: 98:03:9b:82:ba:08->98:03:9b:82:ba:08
Update eth9 MAC address: 98:03:9b:82:ba:10->98:03:9b:82:ba:09
Update eth10 MAC address: 98:03:9b:82:ba:3a->98:03:9b:82:ba:0a
Update eth11 MAC address: 98:03:9b:82:ba:1b->98:03:9b:82:ba:0b
Update eth12 MAC address: 98:03:9b:82:ba:ac->98:03:9b:82:ba:0c
Update eth13 MAC address: 98:03:9b:82:ba:1d->98:03:9b:82:ba:0d
Update eth14 MAC address: 98:03:9b:82:ba:6e->98:03:9b:82:ba:0e
Update eth15 MAC address: 98:03:9b:82:ba:ba->98:03:9b:82:ba:0f
Update eth16 MAC address: 98:03:9b:82:ba:bb->98:03:9b:82:ba:10
Update eth17 MAC address: 98:03:9b:82:ba:a8->98:03:9b:82:ba:11
Update eth18 MAC address: 98:03:9b:82:ba:3b->98:03:9b:82:ba:12
Update eth19 MAC address: 98:03:9b:82:ba:83->98:03:9b:82:ba:13
Update eth20 MAC address: 98:03:9b:82:ba:b4->98:03:9b:82:ba:14
Update eth21 MAC address: 98:03:9b:82:ba:a5->98:03:9b:82:ba:15
Update eth22 MAC address: 98:03:9b:82:ba:f6->98:03:9b:82:ba:16
Update eth23 MAC address: 98:03:9b:82:ba:47->98:03:9b:82:ba:17
Update eth24 MAC address: 98:03:9b:82:ba:58->98:03:9b:82:ba:18
Update eth25 MAC address: 98:03:9b:82:ba:14->98:03:9b:82:ba:19
Update eth26 MAC address: 98:03:9b:82:ba:2a->98:03:9b:82:ba:1a
Update eth27 MAC address: 98:03:9b:82:ba:11->98:03:9b:82:ba:1b
Update eth31 MAC address: de:6b:43:f0:01:8f->de:6b:43:f0:01:1f
Update eth30 MAC address: 2e:4e:f6:38:0a:6e->2e:4e:f6:38:0a:1e
Update eth29 MAC address: fe:46:4a:07:c3:5d->fe:46:4a:07:c3:1d
Update eth28 MAC address: 5e:d2:af:4e:1d:4c->5e:d2:af:4e:1d:1c

./remove_ip.sh
Flush eth0 IP address
Flush eth1 IP address
Flush eth2 IP address
Flush eth3 IP address
Flush eth4 IP address
Flush eth5 IP address
Flush eth6 IP address
Flush eth7 IP address
Flush eth8 IP address
Flush eth9 IP address
Flush eth10 IP address
Flush eth11 IP address
Flush eth12 IP address
Flush eth13 IP address
Flush eth14 IP address
Flush eth15 IP address
Flush eth16 IP address
Flush eth17 IP address
Flush eth18 IP address
Flush eth19 IP address
Flush eth20 IP address
Flush eth21 IP address
Flush eth22 IP address
Flush eth23 IP address
Flush eth24 IP address
Flush eth25 IP address
Flush eth26 IP address
Flush eth27 IP address
Flush eth31 IP address
Flush eth30 IP address
Flush eth29 IP address
Flush eth28 IP address

Any platform specific information?

  • N/A

Supported testbed topology if it's a new test case?

  • N/A

Documentation

  • N/A

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

       .---.        .-----------
      /     \  __  /    ------
     / /     \(  )/    -----
    //////   ' \/ `   ---
   //// / // :    : ---
  // /   /  /`    '--
 //          //..\\
        ====UU====UU====
            '//||\\`
              ''``

Signed-off-by: Nazarii Hnydyn <[email protected]>
ifconfig $i hw ether $mac
set -e

for INTF in $(ip -br link show | grep 'eth' | awk '{sub(/@.*/,"",$1); print $1}'); do
Copy link
Collaborator

Choose a reason for hiding this comment

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

why using capital letters for a parameter name? i don't think this is the convention used in the different scripts.
Any reason why not keeping the names as before? prefix, suffix, mac, addr, etc.
Beside of that i agree we should not use ifconfig any more but only ip commands.

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe the codebase is currently inconsistent; you will find usage of both all-caps and all-lowercase variable names. I personally prefer all-caps for variable names in bash.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jleveque could you please merge this if no more concerns?

@jleveque jleveque merged commit 6b4d02b into sonic-net:master Jul 23, 2019
fraserg-arista pushed a commit to fraserg-arista/sonic-mgmt that referenced this pull request Feb 24, 2026
…onic-net#1022)

<!--
Please make sure you've read and understood our contributing guidelines;
https://github.com/sonic-net/SONiC/blob/gh-pages/CONTRIBUTING.md

Please provide following information to help code review process a bit easier:
-->
### Description of PR
<!--
- Please include a summary of the change and which issue is fixed.
- Please also include relevant motivation and context. Where should reviewer start? background context?
- List any dependencies that are required for this change.
-->

Summary:
Fix `dns/static_dns/test_static_dns.py` not fully cleaning up the DUT state after tests.

There are 2 places where permanent change to the DUT state is done:
1. When `config save -y` is run in `test_static_dns_basic` without backing up the original `/etc/sonic/config_db.json`.
- This is fixed by adding the fixture to backup and restore config_db

2. When an instance of `dhclient` is started in `test_dynamic_dns_not_working_when_static_ip_configured`, which permanently changes the mgmt ip address.
- This is fixed by running `config_reload` after the test. Note: simply changing via `iptable` commands do not work - a `config_reload` is needed to restore the DUT properly.

Fixes sonic-net#22270

### Type of change

<!--
- Fill x for your type of change.
- e.g.
- [x] Bug fix
-->

- [ ] Bug fix
- [ ] Testbed and Framework(new/improvement)
- [ ] New Test case
 - [ ] Skipped for non-supported platforms
- [x] Test case improvement

### Back port request
- [ ] 202205
- [ ] 202305
- [ ] 202311
- [ ] 202405
- [ ] 202411
- [x] msft-202412
- [ ] 202505
- [x] 202511

### Approach
#### What is the motivation for this PR?
Some tests are failing (`test_configurable_drop_counters.py`) when run after `dns/static_dns/test_static_dns.py`.

#### How did you do it?
Add clean up steps to ensure the DUT is recovered to the state before `dns/static_dns/test_static_dns.py` is run.

#### How did you verify/test it?
`test_configurable_drop_counters.py` no longer fails when run after `dns/static_dns/test_static_dns.py`.

#### Any platform specific information?

#### Supported testbed topology if it's a new test case?

### Documentation
<!--
(If it's a new feature, new test case)
Did you update documentation/Wiki relevant to your implementation?
Link to the wiki page?
-->
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
1. remove container feature table
2. do not generate feature entry if the feature is not included
   in the image
3. rename ENABLE_* to INCLUDE_* for better clarity
4. rename feature status to feature state
5. [submodule]: update sonic-utilities

* 9700e45 2020-08-03 | [show/config]: combine feature and container feature cli (sonic-net#1015) (HEAD, origin/master, origin/HEAD) [lguohan]
* c9d3550 2020-08-03 | [tests]: fix drops_group_test failure on second run (sonic-net#1023) [lguohan]
* dfaae69 2020-08-03 | [lldpshow]: Fix input device is not a TTY error (sonic-net#1016) [Arun Saravanan Balachandran]
* 216688e 2020-08-02 | [tests]: rename sonic-utilitie-tests to tests (sonic-net#1022) [lguohan]

Signed-off-by: Guohan Lu <[email protected]>
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.

3 participants