Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

firmware & tools: chamoc tools and chamos module implementation #249

Merged
merged 1 commit into from
May 16, 2022

Conversation

CW-75
Copy link
Collaborator

@CW-75 CW-75 commented May 9, 2022

Contribution description

This is an implementation of vaina source code, The objective of this PR is design an udp client to connect with an device and send it a NIB_ADD request or a NIB_DEL, this device will response with an ACK if the request was received correctly, if the request was wrong received, the device should response with an NACK.

These Pr contains some structures to gives the elements required to this process, refering an client by an interface.

The interface that could be used are that appears in your System. you could see these executing ip address show command or ifconfig

enp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.2.119  netmask 255.255.255.0  broadcast 192.168.2.255
        inet6 fe80::bef4:bb4a:f786:e805  prefixlen 64  scopeid 0x20<link>
...
enx5a008df2d56b: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.199  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::98eb:d858:51a0:dcc0  prefixlen 64  scopeid 0x20<link>
        ether 5a:00:8d:f2:d5:6b  txqueuelen 1000  (Ethernet)
...
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
...

Testing procedure

There are two cases to test the client connection, first testing locally by the an local host and then connecting with an m4a-24g board.

1 - Case °1 Running with chamoc_server test and the chamoc tool.

follow these steps:

  • open two terminals (Terminal A & Terminal B):
# Terminal A
cd test/chamoc_server/
./run.sh

The script will ask about which interface will be used
when you see this output

# Terminal A
Server it's running

means that you are running the chamoc server, this will nerver stop until that received and nib request from a chamoc client.

  • start the client code to local host test:
    note: before to start run the client, it's recommended take note of the iface name (see typing ip address show or ifconfig).
    in terminal B go to dist/tools/chamoc folder and ther run the test script.
# Terminal B
cd dist/tools/chamoc
./test.sh

When you are started you need to fill all the params fields that the script will need to execute te client code, e.g:

# Terminal B
Interface: enp2s0
Ipv6 Address: 2001:db8::1
Ipv6 Address prefix (64 - 128): 64

your expected output should see just like this:

# Terminal A
Server it's running
Packet Received:02004020010db8000000000000000000000001
# Terminal B
running nib add request
Request Confirmed

In terminal A it can look the packet received in hexadecimals pais, where:

Packet representation

02 00 40 20010db8000000000000000000000001
type of message Message sequence number network prefix of the ipv6 address Ipv6 address
Packet HEX Description
02 Refers to the NIB type of message (2) is NIB_ADD, (3) NIB_DEL
00 Refers to Message sequence number
40 It's the network prefix of the ipv6 address (0x40 is 64 in decimal value)
20010db8000000000000000000000001 it's the entered address 2001:db8:1

2 - Case °2 Running with chamos_server in m4a-24g board

follow these steps:

  • open two terminals (Terminal A & Terminal B):
# terminal A
cd dist/tools/chamoc
./autoconfigure.sh

note : you could run the autoconfig script placing your owns parameters to the nib message and setup of the host,
./autoconfigure.sh [ipv6 address]
When you execute the script without any input, by default the script will take the ipv6 address 2001:db8::1 by default.

Issues/PRs references

@CW-75 CW-75 marked this pull request as draft May 9, 2022 05:35
@CW-75 CW-75 added this to the 0.22.06 milestone May 9, 2022
@CW-75 CW-75 self-assigned this May 9, 2022
Copy link
Contributor

@luisan00 luisan00 left a comment

Choose a reason for hiding this comment

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

1.- The tool name is ambiguous
2.- What's the purpose of a command in this tool?

dist/tools/socket_client/socket_msg.h Outdated Show resolved Hide resolved
@CW-75 CW-75 force-pushed the test_comm_sock branch 6 times, most recently from bab50d4 to 6113dd9 Compare May 13, 2022 00:07
@CW-75 CW-75 marked this pull request as ready for review May 13, 2022 00:08
@CW-75 CW-75 requested a review from luisan00 May 13, 2022 00:08
@CW-75 CW-75 force-pushed the test_comm_sock branch from 4870a6d to 847f10d Compare May 13, 2022 03:11
@CW-75 CW-75 requested review from xkevin190 and RocioRojas May 13, 2022 03:33
@CW-75 CW-75 force-pushed the test_comm_sock branch from 847f10d to 1c5b248 Compare May 13, 2022 03:50
Copy link
Contributor

@luisan00 luisan00 left a comment

Choose a reason for hiding this comment

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

nice job !! 💯
just documentation and aesthetics by now

dist/tools/chamoc/.gitignore Outdated Show resolved Hide resolved
dist/tools/chamoc/chamoc_msg.c Outdated Show resolved Hide resolved
firmware/network/chamos/chamos.c Outdated Show resolved Hide resolved
firmware/network/chamos/chamos.c Outdated Show resolved Hide resolved
firmware/network/chamos/include/chamos.h Outdated Show resolved Hide resolved
firmware/network/chamos/include/chamos.h Outdated Show resolved Hide resolved
dist/tools/chamoc/include/chamoc_msg.h Outdated Show resolved Hide resolved
dist/tools/chamoc/include/chamoc_msg.h Outdated Show resolved Hide resolved
dist/tools/chamoc/include/chamoc_msg.h Outdated Show resolved Hide resolved
tests/chamoc_server/.gitignore Outdated Show resolved Hide resolved
Copy link
Collaborator Author

@CW-75 CW-75 left a comment

Choose a reason for hiding this comment

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

Good, only has a little doc corrections and format corrections 👍

firmware/network/chamos/chamos.c Outdated Show resolved Hide resolved
firmware/network/chamos/chamos.c Show resolved Hide resolved
firmware/network/chamos/include/chamos.h Outdated Show resolved Hide resolved
dist/tools/chamoc/include/chamoc_msg.h Outdated Show resolved Hide resolved
dist/tools/chamoc/include/chamoc_msg.h Outdated Show resolved Hide resolved
dist/tools/chamoc/include/chamoc_msg.h Outdated Show resolved Hide resolved
dist/tools/chamoc/include/chamoc_msg.h Outdated Show resolved Hide resolved
dist/tools/chamoc/include/client.h Outdated Show resolved Hide resolved
dist/tools/chamoc/include/client.h Outdated Show resolved Hide resolved
dist/tools/chamoc/include/nib.h Outdated Show resolved Hide resolved
dist/tools/chamoc/nib.c Outdated Show resolved Hide resolved
dist/tools/chamoc/nib.c Outdated Show resolved Hide resolved
dist/tools/chamoc/chamoc_msg.c Outdated Show resolved Hide resolved
dist/tools/chamoc/include/client.h Outdated Show resolved Hide resolved
dist/tools/chamoc/include/nib.h Outdated Show resolved Hide resolved
dist/tools/chamoc/nib.c Outdated Show resolved Hide resolved
dist/tools/chamoc/nib.c Outdated Show resolved Hide resolved
firmware/network/chamos/chamos.c Outdated Show resolved Hide resolved
firmware/network/chamos/chamos.c Show resolved Hide resolved
firmware/network/chamos/chamos.c Outdated Show resolved Hide resolved
firmware/network/chamos/chamos.c Outdated Show resolved Hide resolved
firmware/network/chamos/chamos.c Outdated Show resolved Hide resolved
firmware/network/chamos/chamos.c Show resolved Hide resolved
firmware/network/chamos/chamos.c Show resolved Hide resolved
@CW-75 CW-75 changed the title Tools: Socket_client PC to a m4a-device firmware & tools: chamoc tools and chamos module implementation May 13, 2022
Copy link
Contributor

@luisan00 luisan00 left a comment

Choose a reason for hiding this comment

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

well done. almost finished!

dist/tools/chamoc/start_network.sh Outdated Show resolved Hide resolved
tests/chamoc_server/run.sh Outdated Show resolved Hide resolved
@CW-75 CW-75 force-pushed the test_comm_sock branch 2 times, most recently from a1bc188 to ab08606 Compare May 16, 2022 19:01
@CW-75 CW-75 force-pushed the test_comm_sock branch from ab08606 to 3511afd Compare May 16, 2022 19:08
@CW-75 CW-75 requested a review from luisan00 May 16, 2022 19:10
Copy link
Contributor

@luisan00 luisan00 left a comment

Choose a reason for hiding this comment

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

well dona!! going ahead!! 👍

@CW-75 CW-75 merged commit e132d07 into Mesh4all:main May 16, 2022
@CW-75 CW-75 deleted the test_comm_sock branch May 16, 2022 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants