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

(Question) Duplicate Responses to CIP Discovery Packet #108

Closed
JL00001 opened this issue Mar 15, 2022 · 3 comments
Closed

(Question) Duplicate Responses to CIP Discovery Packet #108

JL00001 opened this issue Mar 15, 2022 · 3 comments

Comments

@JL00001
Copy link

JL00001 commented Mar 15, 2022

I am using CPPPO to simulate a PowerFlex 525. I am also using pycomm3 to craft the CIP Read/Write packets; (I found pycomm3 first). Pycomm3 has a CIP Discovery method, and it is able to see the simulated drive I created, but it seems to return 3 devices instead of 1

Screenshot of it happening:

Screenshot from 2022-03-15 11-24-50

My Simulated Drive Code:

import sys, logging
from Excel_Dump_Lables import Lables
from cpppo.server import enip
from cpppo.server.enip.main import main as enip_main

class DPI_Parameters( enip.Object ):
    class_id			= 0x93
    def __init__( self, name=None, **kwds ):
        super( DPI_Parameters, self ).__init__( name=name, **kwds )
        if self.instance_id == 0:
            pass
        else:
            self.attribute['9']= enip.Attribute( Lables[self.instance_id],	enip.INT, default=self.instance_id )      

def main( **kwds ):
    enip.config_files 	       += [ __file__.replace( '.py', '.cfg' ) ]
    for x in range(1,731):
        DPI_Parameters( name="DPI_Parameters", instance_id=x )
    return enip_main( argv=sys.argv[1:])

sys.exit( main( attribute_class=main,argv=sys.argv[1:]))

Drive Config File:

[Identity]
Product Name			    = PowerFlex 525

[TCPIP]
Interface Status		    = 2  # (Hardware configured)
Configuration Capability	= 48 # (Config Settable, Hardware Settable)
Configuration Control		= 16 # Statically assigned IP, DNS Eanbled
Host Name			    = PowerFlexSimDrive
Path to Physical Link		= [
                            { "class":     246 },
                            { "instance":    1 }
                              ]
                              
Interface Configuration		= {
        "ip_address":		"192.168.1.143",
        "gateway_address":	"192.168.1.1",
        "network_mask":		"255.255.255.0",
        "dns_primary":		"1.1.1.1",
        "dns_secondary":	"8.8.8.8",
        "domain_name":		"example.com"
    }

[UCMM]

"Route Path"			    = false

My Question: Is there a way to check that I am not accidentally spawning more than one drive process?

Or if there is something glaringly wrong with my code

@pjkundert
Copy link
Owner

It looks like 2 responses, not 3... Well, cpppo does bind to both the UDP and TCP port, so perhaps pycomm3 is finding the device on both UDP and TCP? I think Cpppo only does a broadcast request on either TCP or UDP, not both.

Just a guess...

@JL00001
Copy link
Author

JL00001 commented Mar 16, 2022

Would there be a way to tell the simulated PowerFlex drive to not respond to TCP packets? As to test that theory?

@JL00001
Copy link
Author

JL00001 commented Mar 22, 2022

image
image
I think you are right. It is probably operating on both TCP and UDP

@JL00001 JL00001 closed this as completed Mar 22, 2022
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

No branches or pull requests

2 participants