Skip to content

Commit 207ed1c

Browse files
authored
Merge pull request #38 from ShibalovRoman/master
Add skip unused objects option to firepower vendor
2 parents 4252843 + 1f198ba commit 207ed1c

File tree

4 files changed

+28
-5
lines changed

4 files changed

+28
-5
lines changed

CiscoMigration/CiscoConverter.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1608,6 +1608,7 @@ private void Add_Networks()
16081608
{
16091609
var cpHost = new CheckPoint_Host();
16101610
cpHost.Name = network.AutoGeneratedName();
1611+
cpHost.Name = cpHost.SafeName();
16111612
cpHost.IpAddress = network.IpAddress;
16121613
cpHost.ConvertedCommandId = network.CiscoCommandId;
16131614
AddCheckPointObject(cpHost);
@@ -1616,6 +1617,7 @@ private void Add_Networks()
16161617
{
16171618
var cpNetwork = new CheckPoint_Network();
16181619
cpNetwork.Name = network.AutoGeneratedName();
1620+
cpNetwork.Name = cpNetwork.SafeName();
16191621
cpNetwork.Subnet = network.IpAddress;
16201622
cpNetwork.Netmask = network.NetMask;
16211623
cpNetwork.MaskLength = network.MaskPrefix != null ? network.MaskPrefix : "";
@@ -1646,6 +1648,7 @@ private void Add_Objects()
16461648
case Cisco_Object.ObjectTypes.Host:
16471649
var cpHost = new CheckPoint_Host();
16481650
cpHost.Name = ciscoObject.CiscoId;
1651+
cpHost.Name = cpHost.SafeName();
16491652
cpHost.Comments = ciscoObject.Description;
16501653
cpHost.IpAddress = ciscoObject.HostAddress;
16511654
ApplyConversionIncidentOnCheckPointObject(cpHost, ciscoObject);
@@ -1656,6 +1659,7 @@ private void Add_Objects()
16561659
case Cisco_Object.ObjectTypes.Network:
16571660
var cpNetwork = new CheckPoint_Network();
16581661
cpNetwork.Name = ciscoObject.CiscoId;
1662+
cpNetwork.Name = cpNetwork.SafeName();
16591663
cpNetwork.Comments = ciscoObject.Description;
16601664
cpNetwork.Subnet = ciscoObject.Network;
16611665
cpNetwork.Netmask = ciscoObject.Netmask;
@@ -1668,6 +1672,7 @@ private void Add_Objects()
16681672
case Cisco_Object.ObjectTypes.Range:
16691673
var cpRange = new CheckPoint_Range();
16701674
cpRange.Name = ciscoObject.CiscoId;
1675+
cpRange.Name = cpRange.SafeName();
16711676
cpRange.Comments = ciscoObject.Description;
16721677
cpRange.RangeFrom = ciscoObject.RangeFrom;
16731678
cpRange.RangeTo = ciscoObject.RangeTo;
@@ -1679,6 +1684,7 @@ private void Add_Objects()
16791684
case Cisco_Object.ObjectTypes.TcpService:
16801685
var cpTcp = new CheckPoint_TcpService();
16811686
cpTcp.Name = ciscoObject.CiscoId;
1687+
cpTcp.Name = cpTcp.SafeName();
16821688
cpTcp.Comments = ciscoObject.Description;
16831689
cpTcp.Port = ciscoObject.ServicePort;
16841690
ApplyConversionIncidentOnCheckPointObject(cpTcp, ciscoObject);
@@ -1689,6 +1695,7 @@ private void Add_Objects()
16891695
case Cisco_Object.ObjectTypes.UdpService:
16901696
var cpUdp = new CheckPoint_UdpService();
16911697
cpUdp.Name = ciscoObject.CiscoId;
1698+
cpUdp.Name = cpUdp.SafeName();
16921699
cpUdp.Comments = ciscoObject.Description;
16931700
cpUdp.Port = ciscoObject.ServicePort;
16941701
ApplyConversionIncidentOnCheckPointObject(cpUdp, ciscoObject);
@@ -1729,6 +1736,7 @@ private void Add_NetworkGroups()
17291736
{
17301737
var cpNetworkGroup = new CheckPoint_NetworkGroup();
17311738
cpNetworkGroup.Name = ciscoGroup.CiscoId;
1739+
cpNetworkGroup.Name = cpNetworkGroup.SafeName();
17321740
cpNetworkGroup.Comments = ciscoGroup.Description;
17331741
ApplyConversionIncidentOnCheckPointObject(cpNetworkGroup, ciscoGroup);
17341742
CheckObjectNameValidity(cpNetworkGroup, ciscoGroup);
@@ -1784,6 +1792,7 @@ private void Add_InterfacesAndRoutes()
17841792
{
17851793
var cpNetworkGroup = new CheckPoint_NetworkGroup();
17861794
cpNetworkGroup.Name = ciscoInterface.CiscoId + "_subnets";
1795+
cpNetworkGroup.Name = cpNetworkGroup.SafeName();
17871796

17881797
foreach (Cisco_Interface.Subnet subnet in ciscoInterface.Topology)
17891798
{
@@ -1799,6 +1808,7 @@ private void Add_InterfacesAndRoutes()
17991808

18001809
var cpNetwork = new CheckPoint_Network();
18011810
cpNetwork.Name = networkName;
1811+
cpNetwork.Name = cpNetwork.SafeName();
18021812
cpNetwork.Subnet = subnet.Network;
18031813
cpNetwork.Netmask = subnet.Netmask;
18041814
AddCheckPointObject(cpNetwork);
@@ -1846,6 +1856,7 @@ private void Add_Zones()
18461856

18471857
var cpZone = new CheckPoint_Zone();
18481858
cpZone.Name = CiscoCommand.InterfacePrefix + ciscoAccessGroup.InterfaceName;
1859+
cpZone.Name = cpZone.SafeName();
18491860
ApplyConversionIncidentOnCheckPointObject(cpZone, ciscoAccessGroup);
18501861
AddCheckPointObject(cpZone);
18511862
}
@@ -1858,6 +1869,7 @@ private void Add_Zones()
18581869
{
18591870
var cpZone = new CheckPoint_Zone();
18601871
cpZone.Name = ciscoInterface.CiscoId;
1872+
cpZone.Name = cpZone.SafeName();
18611873
cpZone.Comments = "Zone without access-group";
18621874
ApplyConversionIncidentOnCheckPointObject(cpZone, ciscoInterface);
18631875
AddCheckPointObject(cpZone);
@@ -1903,6 +1915,7 @@ private void Add_ServicesAndServiceGroups()
19031915
{
19041916
var cpServiceGroup = new CheckPoint_ServiceGroup();
19051917
cpServiceGroup.Name = ciscoGroup.CiscoId;
1918+
cpServiceGroup.Name = cpServiceGroup.SafeName();
19061919
cpServiceGroup.Comments = ciscoGroup.Description;
19071920

19081921
foreach (string groupName in ciscoGroup.MembersGroupNames)
@@ -2322,6 +2335,7 @@ private void Add_TimeRange(int caTimeId, string caTimeRangeName, string cpTimeRa
23222335

23232336
CheckPoint_Time cpTime = new CheckPoint_Time();
23242337
cpTime.Name = cpTimeRangeName;
2338+
cpTime.Name = cpTime.SafeName();
23252339
cpTime.Comments = "Old Time Object name: " + caTimeRangeName;
23262340
cpTime.StartNow = true;
23272341
cpTime.EndNever = true;

MigrationBase/SupportedVendors.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public class SupportedVendors
2525
#region Constants
2626

2727
public const string CiscoConfigurationFileLabel = "Cisco configuration file:";
28+
public const string FirepowerConfigurationFileLabel = "FirePower configuration file:";
2829
public const string CiscoProduct = "Cisco to Check Point Migration Tool";
2930
public const string CiscoProductDescription = "This tool supports migration of Cisco ASA 8.3\nand above configuration files.";
3031
public const string JuniperConfigurationFileLabel = "JunosOS XML configuration file:";

SmartMove/CommandLine.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public int DisplayHelp()
125125
Console.WriteLine("\t" + "-d | --domain" + "\t\t" + "domain name (for CiscoASA, FirePower, JuniperSRX, JuniperSSG only)");
126126
Console.WriteLine("\t" + "-n | --nat" + "\t\t" + @"(""-n false"" |"" -n true"" [default]) convert NAT configuration [enabled by default]");
127127
Console.WriteLine("\t" + "-l | --ldap" + "\t\t" + "LDAP Account unit for convert user configuration option (for FortiNet, PaloAlto and Panorama only)");
128-
Console.WriteLine("\t" + "-k | --skip" + "\t\t" + @"(""-k false"" |"" -k true"" [default]) do not import unused objects (for FortiNet, PaloAlto, CiscoASA, Panorama, JuniperSRX and JuniperSSG only) [enabled by default]");
128+
Console.WriteLine("\t" + "-k | --skip" + "\t\t" + @"(""-k false"" |"" -k true"" [default]) do not import unused objects (for FortiNet, Firepower, PaloAlto, CiscoASA, Panorama, JuniperSRX and JuniperSSG only) [enabled by default]");
129129
Console.WriteLine("\t" + "-f | --format" + "\t\t" + "format of the output file (JSON[default], TEXT)");
130130
Console.WriteLine("\t" + "-i | --interactive" + "\t" + @"-i false | -i true [default] Interactive mode provides a better user experience.Disable when automation is required[enabled by default]");
131131
Console.WriteLine("\t" + "-a | --analyzer" + "\t\t" + @"mode for analyze package");
@@ -143,7 +143,7 @@ public int CheckOptionsValidity(CommandLine commandLine)
143143
{
144144
var fullVendorsList = new List<string> { "CiscoASA", "JuniperSRX", "JuniperSSG", "FortiNet", "PaloAlto", "Panorama", "FirePower" }; //all vendors
145145
var vendorsList1 = new List<string> { "CiscoASA", "JuniperSRX", "JuniperSSG", "FirePower" }; //option -d
146-
var vendorsList2 = new List<string> { "FortiNet", "PaloAlto", "Panorama", "CiscoASA", "JuniperSRX", "JuniperSSG" }; //option -k
146+
var vendorsList2 = new List<string> { "FortiNet", "PaloAlto", "Panorama", "CiscoASA", "JuniperSRX", "JuniperSSG", "FirePower" }; //option -k
147147
if (String.IsNullOrEmpty(commandLine.Vendor))
148148
{
149149
Console.WriteLine("Option -v is mandatory but not specified.", MessageTypes.Error);
@@ -787,10 +787,12 @@ public void DoAnalyze(CommandLine commandLine)
787787
vendorConverter = converter;
788788
break;
789789
case "FirePower":
790-
vendorConverter = new CiscoConverter()
790+
CiscoConverter fpConverter = new CiscoConverter()
791791
{
792792
isUsingForFirePower = true
793793
};
794+
fpConverter.SkipUnusedObjects = commandLine.DontImportUnusedObjects;
795+
vendorConverter = fpConverter;
794796
break;
795797
case "JuniperSRX":
796798
JuniperConverter juniperConverter = new JuniperConverter();
@@ -1220,7 +1222,8 @@ public void DoMigration(CommandLine commandLine)
12201222
case "FirePower":
12211223
vendorConverter = new CiscoConverter()
12221224
{
1223-
isUsingForFirePower = true
1225+
isUsingForFirePower = true,
1226+
SkipUnusedObjects = commandLine.DontImportUnusedObjects
12241227
};
12251228
break;
12261229
case "JuniperSRX":

SmartMove/MainWindow.xaml.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,10 @@ private void VendorSelector_OnSelectionChanged(object sender, SelectionChangedEv
302302
ConfigurationFileLabel = SupportedVendors.CiscoConfigurationFileLabel;
303303
SkipUnusedObjects.Visibility = Visibility.Visible;
304304
break;
305+
case Vendor.FirePower:
306+
ConfigurationFileLabel = SupportedVendors.FirepowerConfigurationFileLabel;
307+
SkipUnusedObjects.Visibility = Visibility.Visible;
308+
break;
305309
case Vendor.JuniperJunosOS:
306310
ConfigurationFileLabel = SupportedVendors.JuniperConfigurationFileLabel;
307311
SkipUnusedObjects.Visibility = Visibility.Visible;
@@ -632,7 +636,8 @@ private async void Go_OnClick(object sender, RoutedEventArgs e)
632636
break;
633637
case Vendor.FirePower:
634638
vendorConverter = new CiscoConverter() {
635-
isUsingForFirePower = true
639+
isUsingForFirePower = true,
640+
SkipUnusedObjects = SkipUnusedObjectsConversion
636641
};
637642
break;
638643
case Vendor.JuniperJunosOS:

0 commit comments

Comments
 (0)