Skip to content

Commit c4d9fbd

Browse files
authored
Merge pull request #469 from ix-ax/468-Update_all_apax_yamlS_in_all_appS_to_use_hwc_in_yaml_to_use_secure_comm_and_latest_scripts
Update all apax.yamlS in all appS to use hwc in yaml, to use secure comm and latest scripts
2 parents 1f330dd + b22a5f7 commit c4d9fbd

File tree

516 files changed

+8365
-4999
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

516 files changed

+8365
-4999
lines changed

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"rollForward": false
3232
},
3333
"microsoft.visualstudio.slngen.tool": {
34-
"version": "10.3.4",
34+
"version": "12.0.3",
3535
"commands": [
3636
"slngen"
3737
],

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,9 @@ import-cache
423423
#AX HWC compiled
424424
hwc.gen/
425425

426+
#AX HWC templates copied from library
427+
library_templates
428+
426429
#DCP export
427430
dcp_export/
428431

cake/BuildContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public BuildContext(ICakeContext context, BuildParameters buildParameters)
174174
("components.mitsubishi.robotics", "axopen.components.mitsubishi.robotics", true),
175175
("components.ur.robotics", "axopen.components.ur.robotics", true),
176176
("components.kuka.robotics", "axopen.components.kuka.robotics", true),
177-
("components.siemens.identification", "axopen.components.siemens.identification", true),
177+
("components.siem.identification", "axopen.components.siem.identification", true),
178178
("components.balluff.identification", "axopen.components.balluff.identification", true),
179179
("integrations", "ix.integrations", false),
180180
("template.axolibrary", "template.axolibrary", false)

src/abstractions/abstractions.sln

Lines changed: 227 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
CONFIGURATION HardwareIDs
2+
VAR_GLOBAL CONSTANT
3+
plc_line_HwID : UINT := UINT#32;
4+
plc_line_Rail_0_HwID : UINT := UINT#257;
5+
plc_line_plc_line_HwID : UINT := UINT#48;
6+
plc_line_plc_line_CPU_display_1_HwID : UINT := UINT#54;
7+
plc_line_plc_line_Card_reader_writer_1_HwID : UINT := UINT#51;
8+
plc_line_plc_line_DP_interface_1_HwID : UINT := UINT#60;
9+
plc_line_plc_line_OPC_UA_1_HwID : UINT := UINT#117;
10+
plc_line_plc_line_profinet_x1_HwID : UINT := UINT#64;
11+
plc_line_plc_line_profinet_x1_Port_1_HwID : UINT := UINT#65;
12+
plc_line_plc_line_profinet_x1_Port_2_HwID : UINT := UINT#66;
13+
plc_line_plc_line_profinet_x2_HwID : UINT := UINT#72;
14+
plc_line_plc_line_profinet_x2_Port_3_HwID : UINT := UINT#73;
15+
plc_line_plc_line_virtual_communication_interface_HwID : UINT := UINT#135;
16+
profinet_plc_line_HwID : UINT := UINT#256;
17+
18+
END_VAR
19+
END_CONFIGURATION
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CONFIGURATION IoAddresses
2+
VAR_GLOBAL
3+
4+
END_VAR
5+
END_CONFIGURATION

src/abstractions/app/apax.yml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,34 @@ variables:
99
- "--debug" # Generate debug information for target "1500"
1010
PLC_NAME: "plc_line"
1111
DEFAULT_NAMESPACE: "AXOpen.Abstractions"
12+
AXTARGET: 10.10.10.120
13+
AXTARGETPLATFORMINPUT: .\bin\1500\
14+
AX_USERNAME: "adm"
15+
AX_TARGET_PWD: "123ABCDabcd$#!"
16+
USE_PLC_SIM_ADVANCED: "true"
1217
devDependencies:
1318
"@ix-ax/ax-sdk": '0.0.0-dev.0'
1419
dependencies:
1520
"@ix-ax/axopen.core": '0.0.0-dev.0'
16-
installStrategy: strict
21+
"@ix-ax/ax.axopen.app": '0.0.0-dev.0'
22+
"@ix-ax/axopen.simatic1500": '0.0.0-dev.0'
23+
# this is just temporary to be able create hardware configuration using latest hwc version
24+
# upto the moment of releasing new catalog
25+
# installStrategy: strict
26+
"@ix-ax/ax.latest.packages": '0.0.0-dev.0'
27+
installStrategy: overridable
1728
apaxVersion: 3.3.1
1829
scripts:
1930
# For proper execution of these scripts, the following variables need to be defined as environment variables or local variables.
2031
# Local variables can override environment variables.
21-
# It is highly recommended NOT to store secrets such as 'AX_USERNAME' and 'MY_VERY_STRONG_PASSWORD' in local variables.
32+
# It is highly recommended NOT to store secrets such as 'AX_USERNAME' and 'AX_TARGET_PWD' in local variables.
2233
# PLC_NAME: Name of the PLC (also equal to the PLC Profinet name)
2334
# DEFAULT_NAMESPACE: Namespace used for HwId and IO addresses
2435
# AX_USERNAME: Name of the PLC user used for WebAPI and HMI
2536
# AXTARGET: IP address of the PLC
2637
# AXTARGETPLATFORMINPUT: Folder of the compiled software to be downloaded to the PLC. Use the value ".\bin\1500\" for the S7-1500 controller, even if running inside PLCSIM
2738
# AXTARGETPLCSIMINSTANCE: Name of the PLCSIM instance to start. The instance must already exist.
28-
# MY_VERY_STRONG_PASSWORD: Password for 'AX_USERNAME'
39+
# AX_TARGET_PWD: Password for 'AX_USERNAME'
2940
# USE_PLC_SIM_ADVANCED with value of "true" will automatically trigger PlcSimAdvanced when calling apax alf or apax all
3041
# PNIO_MAC: MAC address of the network adapter connected to the Profinet network
3142
plcsim: ..\\..\\scripts\\plcsimadvanced.sh $APAX_YML_NAME $PLC_NAME $AXTARGET
@@ -59,7 +70,7 @@ scripts:
5970
..\\..\\scripts\\clean_plc.sh $AXTARGET
6071
6172
ssc: | # setup secure communication, create and import certificates, setup password for AX_USERNAME
62-
..\\..\\scripts\\setup_secure_communication.sh $PLC_NAME $AX_USERNAME $MY_VERY_STRONG_PASSWORD
73+
..\\..\\scripts\\setup_secure_communication.sh $PLC_NAME $AX_USERNAME $AX_TARGET_PWD
6374
6475
gsd: | # copy and install all gsdml files from library
6576
..\\..\\scripts\\copy_and_install_gsd.sh
@@ -77,7 +88,7 @@ scripts:
7788
..\\..\\scripts\\copy_io_addresses.sh $DEFAULT_NAMESPACE $PLC_NAME
7889
7990
hwfd: | # copy and install gsd, copy templates,compile, copy the HwIds, copy the IoAddresses, first download HW using password and upload certificate
80-
..\\..\\scripts\\hw_first_download.sh $DEFAULT_NAMESPACE $PLC_NAME $AXTARGET $MY_VERY_STRONG_PASSWORD
91+
..\\..\\scripts\\hw_first_download.sh $DEFAULT_NAMESPACE $PLC_NAME $AXTARGET $AX_TARGET_PWD
8192
8293
hwu: | # copy and install gsd, copy templates, compile, copy the HwIds, copy the IoAddresses, download HW using certificate
8394
..\\..\\scripts\\hw_update.sh $DEFAULT_NAMESPACE $PLC_NAME $AXTARGET
@@ -90,10 +101,10 @@ scripts:
90101
91102
alf: | #clear plc except ip and name and provide all actions for install all, build and initial download hw so as sw
92103
START=$(date +%s)
93-
..\\..\\scripts\\all_first.sh $DEFAULT_NAMESPACE $PLC_NAME $AXTARGET $AXTARGETPLATFORMINPUT $AX_USERNAME $MY_VERY_STRONG_PASSWORD $USE_PLC_SIM_ADVANCED
104+
..\\..\\scripts\\all_first.sh $DEFAULT_NAMESPACE $PLC_NAME $AXTARGET $AXTARGETPLATFORMINPUT $AX_USERNAME $AX_TARGET_PWD $USE_PLC_SIM_ADVANCED
94105
echo $(date +%D)"-"$(date +%H)":"$(date +%M)":"$(date +%S) " - Finished in :" $(expr $(date +%s) - $START) "s"
95106
96107
all: | #build and download hardware and software
97108
START=$(date +%s)
98-
..\\..\\scripts\\all.sh $DEFAULT_NAMESPACE $PLC_NAME $AXTARGET $AXTARGETPLATFORMINPUT $AX_USERNAME $MY_VERY_STRONG_PASSWORD $USE_PLC_SIM_ADVANCED
109+
..\\..\\scripts\\all.sh $DEFAULT_NAMESPACE $PLC_NAME $AXTARGET $AXTARGETPLATFORMINPUT $AX_USERNAME $AX_TARGET_PWD $USE_PLC_SIM_ADVANCED
99110
echo $(date +%D)"-"$(date +%H)":"$(date +%M)":"$(date +%S) " - Finished in :" $(expr $(date +%s) - $START) "s"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Devices:
2+
- Name: plc_line
3+
Modules:
4+
- Apply:
5+
TemplateName: 6ES7516-3AP03-0AB0_v3_1
6+
Arguments:
7+
PLCName: plc_line
8+
IpAddress_X1: 10.10.10.120/24
9+
ProfinetDeviceName_X1: plc_line_x1
10+
IoSystems:
11+
- Name: profinet_plc_line
12+
ControllerInterfaces:
13+
- Ref: plc_line/plc_line/profinet_x1

src/abstractions/app/ix-blazor/librarytemplate.blazor/Pages/Documentation.razor

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@page "/Documentation"
2+
@using abstractions_app
23

34
<PageTitle>Documentation</PageTitle>
45

src/abstractions/app/ix-blazor/librarytemplate.blazor/Pages/Testing.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@page "/testing"
2-
@using librarytemplate
2+
@using abstractions_app
33

44
<PageTitle>Testing</PageTitle>
55

src/abstractions/app/ix-blazor/librarytemplate.blazor/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
using Serilog;
1414
using AXOpen;
1515
using AXOpen.Logging;
16-
using librarytemplate;
16+
using abstractions_app;
1717

1818
var builder = WebApplication.CreateBuilder(args);
1919

src/abstractions/app/ix/Entry.cs

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,44 @@
55
using System.Text;
66
using System.Threading.Tasks;
77
using AXSharp.Connector.S71500.WebApi;
8+
using System.Net.Security;
9+
using System.Reflection;
10+
using System.Security.Cryptography.X509Certificates;
811

9-
namespace librarytemplate
12+
namespace abstractions_app
1013
{
11-
public static class Entry
14+
public class ConnectionConfig
15+
{
16+
public string TargetIp { get; set; } = string.Empty;
17+
public string UserName { get; set; } = string.Empty;
18+
public string Password { get; set; } = string.Empty;
19+
public Func<HttpRequestMessage, X509Certificate2, X509Chain, SslPolicyErrors, bool>? CertificateValidationCallback { get; set; }
20+
public bool IgnoreSslErrors { get; set; } = true;
21+
}
22+
23+
public class TwinConnectorSelector
1224
{
13-
private static readonly string TargetIp = Environment.GetEnvironmentVariable("AXTARGET"); // <- replace by your IP
14-
private const string UserName = "Everybody"; //<- replace by user name you have set up in your WebAPI settings
15-
private const string Pass = ""; // <- Pass in the password that you have set up for the user. NOT AS PLAIN TEXT! Use user secrets instead.
25+
public static string TargetIp { get; } = "10.10.10.120";//Environment.GetEnvironmentVariable("AXTARGET"); // <- replace by your IP
26+
private static string Pass => @"123ABCDabcd$#!"; //Environment.GetEnvironmentVariable("AX_TARGET_PWD"); //Environment.GetEnvironmentVariable("AX_TARGET_PWD"); // <- Pass in the password that you have set up for the user. NOT AS PLAIN TEXT! Use user secrets instead.
27+
private static string UserName = "adm"; //Environment.GetEnvironmentVariable("AX_USERNAME"); //<- replace by user name you have set up in your WebAPI settings
1628
private const bool IgnoreSslErrors = true; // <- When you have your certificates in order set this to false.
29+
private static string CertificatePath = "..\\certs\\plc_line\\plc_line.cer";
30+
31+
static readonly X509Certificate2 Certificate = new X509Certificate2(CertificatePath);
32+
1733

18-
public static abstractions_appTwinController Plc { get; }
34+
private static bool CertificateValidation(HttpRequestMessage requestMessage, X509Certificate2 certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
35+
{
36+
return certificate.Thumbprint == Certificate.Thumbprint;
37+
}
38+
39+
public static abstractions_appTwinController SecurePlc { get; }
1940
= new(ConnectorAdapterBuilder.Build()
20-
.CreateWebApi(TargetIp, UserName, Pass, IgnoreSslErrors));
41+
.CreateWebApi(TargetIp, UserName, Pass, CertificateValidation, IgnoreSslErrors));
42+
}
43+
44+
public static class Entry
45+
{
46+
public static abstractions_appTwinController Plc { get; } = TwinConnectorSelector.SecurePlc;
2147
}
2248
}

src/abstractions/app/ix/abstractions_app.csproj

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,17 @@
2020
<Content Include=".meta\**" />
2121
</ItemGroup>
2222

23-
<ItemGroup>
23+
<!-- <ItemGroup> -->
24+
<!-- <None Include="..\certs\plc_line\plc_line.cer" Link="certs\plc_line\plc_line.cer"> -->
25+
<!-- <CopyToOutputDirectory>Always</CopyToOutputDirectory> -->
26+
<!-- </None> -->
27+
<!-- </ItemGroup> -->
28+
29+
30+
<ItemGroup>
2431
<ProjectReference Include="..\..\..\core\src\AXOpen.Core\ix_ax_axopen_core.csproj" />
2532
<ProjectReference Include="..\..\src\AXOpen.Abstractions\ix_ax_axopen_abstractions.csproj" />
2633
<ProjectReference Include="..\..\..\timers\src\AXOpen.Timers\ix_ax_axopen_timers.csproj" />
34+
<ProjectReference Include="..\..\..\simatic1500\ctrl\ix\ix_ax_axopen_simatic1500.csproj" />
2735
</ItemGroup>
2836
</Project>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
NAMESPACE AXOpen.Abstractions
2+
TYPE
3+
HwIdentifiers : WORD
4+
(
5+
plc_line_HwID := WORD#32,
6+
plc_line_Rail_0_HwID := WORD#257,
7+
plc_line_plc_line_HwID := WORD#48,
8+
plc_line_plc_line_CPU_display_1_HwID := WORD#54,
9+
plc_line_plc_line_Card_reader_writer_1_HwID := WORD#51,
10+
plc_line_plc_line_DP_interface_1_HwID := WORD#60,
11+
plc_line_plc_line_OPC_UA_1_HwID := WORD#117,
12+
plc_line_plc_line_profinet_x1_HwID := WORD#64,
13+
plc_line_plc_line_profinet_x1_Port_1_HwID := WORD#65,
14+
plc_line_plc_line_profinet_x1_Port_2_HwID := WORD#66,
15+
plc_line_plc_line_profinet_x2_HwID := WORD#72,
16+
plc_line_plc_line_profinet_x2_Port_3_HwID := WORD#73,
17+
plc_line_plc_line_virtual_communication_interface_HwID := WORD#135,
18+
profinet_plc_line_HwID := WORD#256,
19+
20+
NONE := WORD#0
21+
);
22+
END_TYPE
23+
END_NAMESPACE

src/abstractions/app/src/IO/Inputs.st

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
NAMESPACE AXOpen.Abstractions
2+
TYPE
3+
{S7.extern=ReadWrite}
4+
{#ix-attr:[Container(Layout.Wrap)]}
5+
Inputs : STRUCT
6+
noInputsFoundInTheHwConfig AT %B0: BYTE;
7+
END_STRUCT;
8+
END_TYPE
9+
END_NAMESPACE
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
NAMESPACE AXOpen.Abstractions
2+
TYPE
3+
{S7.extern=ReadWrite}
4+
{#ix-attr:[Container(Layout.Wrap)]}
5+
Outputs : STRUCT
6+
noOutputsFoundInTheHwConfig AT %B0: BYTE;
7+
END_STRUCT;
8+
END_TYPE
9+
END_NAMESPACE

src/abstractions/app/src/program.st

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ PROGRAM MyProgram
66
_rtm : AXOpen.S71500.Rtm;
77
END_VAR
88

9-
sandbox.Run();
109
sandbox.InjectRtc(_rtc);
1110
sandbox.InjectRtm(_rtm);
11+
sandbox.Run();
1212

1313

14-
documentation.Run();
1514
documentation.InjectRtc(_rtc);
1615
documentation.InjectRtm(_rtm);
16+
documentation.Run();
1717
END_PROGRAM

src/abstractions/slngen.ps1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
dotnet slngen this.proj -o this.sln --folders true --launch false
1+
dotnet slngen this.proj -o this.sln --folders true --launch false
2+
3+
$currentDirectory = Split-Path -Leaf (Get-Location).Path
4+
$sourceFile = Join-Path (Get-Location).Path "this.sln"
5+
$destinationFile = Join-Path (Get-Location).Path ("$currentDirectory.sln")
6+
if (Test-Path $sourceFile) {
7+
Copy-Item -Path $sourceFile -Destination $destinationFile -Force
8+
}

0 commit comments

Comments
 (0)